fprime-gds 3.6.1__py3-none-any.whl → 3.6.2a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,18 @@ class JsonLoader(dict_loader.DictLoader):
71
71
  self.json_dict["metadata"].get("projectVersion", "unknown"),
72
72
  )
73
73
 
74
+ def get_metadata(self):
75
+ """Get the metadata field of the JSON dictionary
76
+
77
+ Raises:
78
+ GdsDictionaryParsingException: if the dictionary has no metadata field
79
+ """
80
+ if "metadata" not in self.json_dict:
81
+ raise GdsDictionaryParsingException(
82
+ f"Dictionary has no metadata field: {self.json_file}"
83
+ )
84
+ return self.json_dict["metadata"]
85
+
74
86
  def parse_type(self, type_dict: dict) -> BaseType:
75
87
  type_name: str = type_dict.get("name", None)
76
88
 
@@ -102,6 +114,9 @@ class JsonLoader(dict_loader.DictLoader):
102
114
  f"Dictionary type name has no corresponding type definition: {type_name}"
103
115
  )
104
116
 
117
+ if qualified_type.get("kind") == "alias":
118
+ return self.parse_type(qualified_type.get("underlyingType"))
119
+
105
120
  if qualified_type.get("kind") == "array":
106
121
  return self.construct_array_type(type_name, qualified_type)
107
122
 
@@ -7,20 +7,16 @@ class called "Dictionaries".
7
7
  @author mstarch
8
8
  """
9
9
 
10
- import os
11
10
  from pathlib import Path
12
11
 
13
- import fprime_gds.common.loaders.ch_py_loader
14
- import fprime_gds.common.loaders.ch_xml_loader
15
-
16
- # Py Loaders
17
- import fprime_gds.common.loaders.cmd_py_loader
18
12
 
19
13
  # XML Loaders
14
+ import fprime_gds.common.loaders.ch_xml_loader
20
15
  import fprime_gds.common.loaders.cmd_xml_loader
21
- import fprime_gds.common.loaders.event_py_loader
22
16
  import fprime_gds.common.loaders.event_xml_loader
23
17
  import fprime_gds.common.loaders.pkt_xml_loader
18
+
19
+ # JSON Loaders
24
20
  import fprime_gds.common.loaders.ch_json_loader
25
21
  import fprime_gds.common.loaders.cmd_json_loader
26
22
  import fprime_gds.common.loaders.event_json_loader
@@ -50,6 +46,7 @@ class Dictionaries:
50
46
  self._channel_name_dict = None
51
47
  self._packet_dict = None
52
48
  self._versions = None
49
+ self._metadata = None
53
50
 
54
51
  def load_dictionaries(self, dictionary, packet_spec):
55
52
  """
@@ -59,57 +56,39 @@ class Dictionaries:
59
56
  :param dictionary: dictionary path used for loading dictionaries
60
57
  :param packet_spec: specification for packets, or None, for packetized telemetry
61
58
  """
62
- # Loading the dictionaries from a directory. A directory indicates heritage python dicts.
63
- if os.path.isdir(dictionary):
64
- # Events
65
- event_loader = fprime_gds.common.loaders.event_py_loader.EventPyLoader()
66
- self._event_id_dict = event_loader.get_id_dict(
67
- os.path.join(dictionary, "events")
68
- )
69
- self._event_name_dict = event_loader.get_name_dict(
70
- os.path.join(dictionary, "events")
71
- )
72
- # Commands
73
- command_loader = fprime_gds.common.loaders.cmd_py_loader.CmdPyLoader()
74
- self._command_id_dict = command_loader.get_id_dict(
75
- os.path.join(dictionary, "commands")
76
- )
77
- self._command_name_dict = command_loader.get_name_dict(
78
- os.path.join(dictionary, "commands")
79
- )
80
- # Channels
81
- channel_loader = fprime_gds.common.loaders.ch_py_loader.ChPyLoader()
82
- self._channel_id_dict = channel_loader.get_id_dict(
83
- os.path.join(dictionary, "channels")
84
- )
85
- self._channel_name_dict = channel_loader.get_name_dict(
86
- os.path.join(dictionary, "channels")
87
- )
88
- elif Path(dictionary).is_file() and ".json" in Path(dictionary).suffixes:
59
+ if Path(dictionary).is_file() and ".json" in Path(dictionary).suffixes:
89
60
  # Events
90
61
  json_event_loader = (
91
62
  fprime_gds.common.loaders.event_json_loader.EventJsonLoader(dictionary)
92
63
  )
93
64
  self._event_name_dict = json_event_loader.get_name_dict(None)
94
65
  self._event_id_dict = json_event_loader.get_id_dict(None)
95
- self._versions = json_event_loader.get_versions()
96
66
  # Commands
97
67
  json_command_loader = (
98
68
  fprime_gds.common.loaders.cmd_json_loader.CmdJsonLoader(dictionary)
99
69
  )
100
70
  self._command_name_dict = json_command_loader.get_name_dict(None)
101
71
  self._command_id_dict = json_command_loader.get_id_dict(None)
102
- assert (
103
- self._versions == json_command_loader.get_versions()
104
- ), "Version mismatch while loading"
105
72
  # Channels
106
73
  json_channel_loader = fprime_gds.common.loaders.ch_json_loader.ChJsonLoader(
107
74
  dictionary
108
75
  )
109
76
  self._channel_name_dict = json_channel_loader.get_name_dict(None)
110
77
  self._channel_id_dict = json_channel_loader.get_id_dict(None)
78
+ # Metadata
79
+ self._versions = json_event_loader.get_versions()
80
+ self._metadata = json_event_loader.get_metadata().copy()
81
+ self._metadata["dictionary_type"] = "json"
82
+ # Each loaders should agree on metadata and versions
83
+ assert (
84
+ json_command_loader.get_metadata()
85
+ == json_channel_loader.get_metadata()
86
+ == json_event_loader.get_metadata()
87
+ ), "Metadata mismatch while loading"
111
88
  assert (
112
- self._versions == json_channel_loader.get_versions()
89
+ json_command_loader.get_versions()
90
+ == json_channel_loader.get_versions()
91
+ == json_event_loader.get_versions()
113
92
  ), "Version mismatch while loading"
114
93
  # XML dictionaries
115
94
  elif Path(dictionary).is_file():
@@ -132,6 +111,12 @@ class Dictionaries:
132
111
  assert (
133
112
  self._versions == channel_loader.get_versions()
134
113
  ), "Version mismatch while loading"
114
+ # versions are camelCase to match the metadata field of the JSON dictionaries
115
+ self._metadata = {
116
+ "frameworkVersion": self._versions[0],
117
+ "projectVersion": self._versions[1],
118
+ "dictionary_type": "xml",
119
+ }
135
120
  else:
136
121
  msg = f"[ERROR] Dictionary '{dictionary}' does not exist."
137
122
  raise Exception(msg)
@@ -184,6 +169,14 @@ class Dictionaries:
184
169
  """Framework version in dictionary"""
185
170
  return self._versions[0]
186
171
 
172
+ @property
173
+ def metadata(self):
174
+ """Dictionary metadata.
175
+
176
+ Note: framework_version and project_version are also available as separate properties
177
+ for legacy reasons. New code should use the metadata property."""
178
+ return self._metadata
179
+
187
180
  @property
188
181
  def packet(self):
189
182
  """Packet dictionary"""
fprime_gds/flask/app.py CHANGED
@@ -84,6 +84,7 @@ def construct_app():
84
84
  pipeline.dictionaries.command_name,
85
85
  pipeline.dictionaries.project_version,
86
86
  pipeline.dictionaries.framework_version,
87
+ pipeline.dictionaries.metadata,
87
88
  ],
88
89
  )
89
90
  api.add_resource(
@@ -103,6 +104,7 @@ def construct_app():
103
104
  pipeline.dictionaries.event_id,
104
105
  pipeline.dictionaries.project_version,
105
106
  pipeline.dictionaries.framework_version,
107
+ pipeline.dictionaries.metadata,
106
108
  ],
107
109
  )
108
110
  api.add_resource(
@@ -117,6 +119,7 @@ def construct_app():
117
119
  pipeline.dictionaries.channel_id,
118
120
  pipeline.dictionaries.project_version,
119
121
  pipeline.dictionaries.framework_version,
122
+ pipeline.dictionaries.metadata,
120
123
  ],
121
124
  )
122
125
  api.add_resource(
@@ -17,17 +17,19 @@ class DictionaryResource(Resource):
17
17
  should be flask compatible. Errors with the dictionary are a 500 server error and may not be recovered.
18
18
  """
19
19
 
20
- def __init__(self, dictionary, project_version, framework_version):
20
+ def __init__(self, dictionary, project_version, framework_version, metadata):
21
21
  """Constructor used to setup for dictionary
22
22
 
23
23
  Args:
24
24
  dictionary: dictionary to serve when GET is called
25
25
  project_version: project version for the dictionary
26
26
  framework_version: project version for the dictionary
27
+ metadata (dict): additional metadata to serve with the dictionary
27
28
  """
28
29
  self.dictionary = dictionary
29
30
  self.project_version = project_version
30
31
  self.framework_version = framework_version
32
+ self.metadata = metadata
31
33
 
32
34
  def get(self):
33
35
  """HTTP GET method handler for dictionary resource
@@ -38,7 +40,8 @@ class DictionaryResource(Resource):
38
40
  return {
39
41
  "dictionary": self.dictionary,
40
42
  "project_version": self.project_version,
41
- "framework_version": self.framework_version
43
+ "framework_version": self.framework_version,
44
+ "metadata": self.metadata
42
45
  }
43
46
 
44
47
 
@@ -197,12 +197,17 @@ Vue.component("chart-display", {
197
197
  if (this.selected == null || this.chart == null) {
198
198
  return;
199
199
  }
200
- // Get channel name assuming the string is in component.channel format.
200
+ // Get channel name assuming the string is in either of these format:
201
+ // - component.channel format for XML dictionaries
202
+ // - deployment.component.channel for JSON dictionaries
203
+ // Can't just slice by last '.' because channel name can include complex types
204
+ // which are in the form of 'component.channel.fieldName'
205
+ let SLICE_INDEX = _dictionaries.metadata.dictionary_type == "xml" ? 2 : 3;
201
206
  let channel_full_name = this.selected
202
207
  .split(".")
203
- .slice(0, 2)
208
+ .slice(0, SLICE_INDEX)
204
209
  .join(".");
205
- let serial_path = this.selected.split(".").slice(2).join(".");
210
+ let serial_path = this.selected.split(".").slice(SLICE_INDEX).join(".");
206
211
 
207
212
  // Filter channels down to the graphed channel
208
213
  let new_channels = channels.filter((channel) => {
@@ -253,6 +253,7 @@ class DataStore {
253
253
  commands_by_id: Object.fromEntries(Object.values(_loader.endpoints["command-dict"].data.dictionary).map((value) => [value.id, value])),
254
254
  framework_version: _loader.endpoints["command-dict"].data.framework_version,
255
255
  project_version: _loader.endpoints["command-dict"].data.project_version,
256
+ metadata: _loader.endpoints["command-dict"].data.metadata,
256
257
  });
257
258
  // Setup channels object in preparation for updates. Channel object need to be well formed, even if blank,
258
259
  // because rendering of edit-views is still possible.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fprime-gds
3
- Version: 3.6.1
3
+ Version: 3.6.2a1
4
4
  Summary: F Prime Flight Software Ground Data System layer
5
5
  Author-email: Michael Starch <Michael.D.Starch@jpl.nasa.gov>, Thomas Boyer-Chammard <Thomas.Boyer.Chammard@jpl.nasa.gov>
6
6
  License:
@@ -58,18 +58,14 @@ fprime_gds/common/history/ram.py,sha256=ELNlyC6SmQJ-ZKD1NRi4H892tt1ppDNfz7R2c0UF
58
58
  fprime_gds/common/history/test.py,sha256=JMOlXPYtS9OTT1xb0GKn2YLI-0ESElbhvhb8usFatz0,5048
59
59
  fprime_gds/common/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  fprime_gds/common/loaders/ch_json_loader.py,sha256=YF0nkDTlEJVZVTBWnjID8HFj8W9yq-hV2CkiyayCuhE,4079
61
- fprime_gds/common/loaders/ch_py_loader.py,sha256=NKJV03k9jOUB9vELVSXyCorIiUwbGx-MlatwOPsUAP8,2688
62
61
  fprime_gds/common/loaders/ch_xml_loader.py,sha256=wRXAC3GkUShvKtb89O5tY92BtKWOFYoJ7loOF7aL5v8,4093
63
62
  fprime_gds/common/loaders/cmd_json_loader.py,sha256=wcwAaalRHXntAb9m0EvX-fXNCj_ruITzItOvKKhXsGQ,3059
64
- fprime_gds/common/loaders/cmd_py_loader.py,sha256=6d_vMP0Vbpg2fnnV4qUtkC-WzlYkVm5kvTUABH-zp4E,2252
65
63
  fprime_gds/common/loaders/cmd_xml_loader.py,sha256=X-fCzLt1aCjqsDu-Exy2gSYDnh_TYi5rDnRpYT7tCZQ,2391
66
64
  fprime_gds/common/loaders/dict_loader.py,sha256=TasuICjsRYPWAsgmHGmsioxa8F7xmgAj9_UplzczylA,3990
67
65
  fprime_gds/common/loaders/event_json_loader.py,sha256=DPVJQ1wIY3r13rxTWrE9n7i6kSAF5m4jB-XRsxaRaDA,3572
68
- fprime_gds/common/loaders/event_py_loader.py,sha256=m4KlDl0mXn8ZQr-IfpUg0KaGIOJUErZkcIohlW9jNPc,2598
69
66
  fprime_gds/common/loaders/event_xml_loader.py,sha256=Q3Vm7ROTVgolSp5umkNMp0Eh95sir6ZAyAegrSjkiis,2875
70
- fprime_gds/common/loaders/json_loader.py,sha256=nXdu3eDI7_FSVbNmjbldFjReBQTxMLg14BpZlSGIAeM,8750
67
+ fprime_gds/common/loaders/json_loader.py,sha256=YTvNkVRbaeDAKDs79J5RV7Z8zeO7x0_a8aIz5KLq9rA,9300
71
68
  fprime_gds/common/loaders/pkt_xml_loader.py,sha256=ZS4qchqQnIBx0Tw69ehP8yqm1g_uYSQzmnijR3FxqJg,4795
72
- fprime_gds/common/loaders/python_loader.py,sha256=FUNQbFy75bpqvss1JDu2UWZBMrtnMpFegM6mcglh42I,4858
73
69
  fprime_gds/common/loaders/xml_loader.py,sha256=8AlTTHddJbJqUr6St-zJI8CTqoPuCNtNoRBmdwCorcg,14820
74
70
  fprime_gds/common/logger/__init__.py,sha256=YBrr9An0fZbp4kvphRl8nLfolkdBqFAsSGzEZXQiH6g,1448
75
71
  fprime_gds/common/logger/data_logger.py,sha256=VjfhTGO1gGw954xNhSc0_zpw8JexCho5f8BlXDEYkL4,2505
@@ -82,7 +78,7 @@ fprime_gds/common/models/common/event.py,sha256=gSFrCJT9ZddGJfkf3fGCCqk0aMIQV-SN
82
78
  fprime_gds/common/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
79
  fprime_gds/common/parsers/seq_file_parser.py,sha256=6DZrA0jmt8IqsutfK7pdLtYn4oVHO593rWgAOH63yRg,9587
84
80
  fprime_gds/common/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
- fprime_gds/common/pipeline/dictionaries.py,sha256=j2vPt6P-jPzjlGOfEPwLrkPfQe-QhbjdjL91q4r_w38,7149
81
+ fprime_gds/common/pipeline/dictionaries.py,sha256=T79xD30tbTupcDcfL2VDRw0YY-lUMN7xTjLYP7pStgU,6733
86
82
  fprime_gds/common/pipeline/encoding.py,sha256=rMCBoZOrnLctl4QNlbMro_QiCQ4sapWjtcoFGfvO-WM,6631
87
83
  fprime_gds/common/pipeline/files.py,sha256=J2zm0sucvImtmSnv0iUp5uTpvUO8nlmz2lUdMuMC5aM,2244
88
84
  fprime_gds/common/pipeline/histories.py,sha256=P1TN6mFOe9f5cZ_a-vCDN9o94vM7ax9n6fQogfUCce0,3548
@@ -115,7 +111,7 @@ fprime_gds/executables/run_deployment.py,sha256=01tI0JVONRkKaPPdfJS0Qt1mWm_7Wgf3
115
111
  fprime_gds/executables/tcpserver.py,sha256=KspVpu5YIuiWKOk5E6UDMKvqXYrRB1j9aX8CkMxysfw,17555
116
112
  fprime_gds/executables/utils.py,sha256=SbzXRe1p41qMPdifvPap5_4v0T42gZZ_Rs_OYfITd80,7626
117
113
  fprime_gds/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
- fprime_gds/flask/app.py,sha256=kJDCziri_BwZWKUszkR7u3RaNG_FWRzDkdCPsVDAtYM,6720
114
+ fprime_gds/flask/app.py,sha256=2LTjx5MFP18ypYz_l80i4ijAWuxv7IVtmzCgCk0fBy8,6852
119
115
  fprime_gds/flask/channels.py,sha256=sOeL-UmWPh2hqYvqj81STpABLlPcjdPgkRwjd3Qx77k,735
120
116
  fprime_gds/flask/commands.py,sha256=62R3b0mnjc3_XpULpqJyUSvAcfOjAyZNifQ3wqHKO7s,3658
121
117
  fprime_gds/flask/components.py,sha256=a-eG8XJfSrqR8MIzIc9StwbNwxcBqkxYMEYq46S2Bmk,4176
@@ -125,7 +121,7 @@ fprime_gds/flask/events.py,sha256=BO9OUUwNDnRuOz4ZC6nFHMR7sJJ9P2P0xUxDluGd218,73
125
121
  fprime_gds/flask/json.py,sha256=PBljX3afJzyE_04DvZS4OEFOQW_ldVmfWiTYfxPZiGo,5888
126
122
  fprime_gds/flask/logs.py,sha256=CzHkXtv7_UG2b1c_z_cGIw-jJT088Sb7DggEB3c9D8U,1571
127
123
  fprime_gds/flask/requirements.txt,sha256=K6y8h0MJ66Zq9Pz2ZIR721wV0EX1mYDfom2gmBobxb4,20
128
- fprime_gds/flask/resource.py,sha256=h_zYGODshaInGQi2EpfU5ScDsQCR1RwqS8f7DzyuIOI,4131
124
+ fprime_gds/flask/resource.py,sha256=1gMu2ITtm1YTTe0fksOQOk2OP4Y9gnyWAdf4B7Sst8A,4291
129
125
  fprime_gds/flask/sequence.py,sha256=1FfOFIUdWFX1qXjONAWm1vklPbyhkBYkuPow8RBt-yk,3554
130
126
  fprime_gds/flask/stats.py,sha256=i62envu9V6WpNsRD_mlhwzB_2dGUOCTf1XpyC5HApzg,1177
131
127
  fprime_gds/flask/updown.py,sha256=7za_zgOwQKHgm-3W1OBZqBgDLCmj7c0ziFEduhEuqdU,6176
@@ -143,7 +139,7 @@ fprime_gds/flask/static/addons/channel-render/addon.js,sha256=zAM8H_cVQp4qwXo_9c
143
139
  fprime_gds/flask/static/addons/channel-render/channel-render-template.js,sha256=wS8JOTUWp3OYwVYkBDTRJQjSiIdWFgmbnoMV4RukYj8,1966
144
140
  fprime_gds/flask/static/addons/channel-render/channel-render.js,sha256=hL0aGcnm8HEkhz0leKS7phxYFiG3vzWRznDX0qU4t6c,5080
145
141
  fprime_gds/flask/static/addons/chart-display/addon-templates.js,sha256=gyKy_uIh47s8Yia_xyeL81F-XQ3KpXT48IUo6Q_PwqI,6549
146
- fprime_gds/flask/static/addons/chart-display/addon.js,sha256=wEorz3UhLIyS6oqysUL6Kbq4m4UJPRzbTp7MZh1yVY8,9185
142
+ fprime_gds/flask/static/addons/chart-display/addon.js,sha256=uYBnpK0VqlpOx1aRVr_Cv5AQ7dzGtjsrXHH1xWZtljo,9582
147
143
  fprime_gds/flask/static/addons/chart-display/config.js,sha256=df1HOg3D4v8623yIAZ0ipyWtj5Ip5tVQGyEjnREqObQ,3893
148
144
  fprime_gds/flask/static/addons/chart-display/sibling.js,sha256=2-k13yGpmF69kyBdAPR0tkO1kALQ1FnP3JmdJ01Lbes,3604
149
145
  fprime_gds/flask/static/addons/chart-display/modified-vendor/chartjs-plugin-streaming.js,sha256=zSynedxrMPIlkFT-tROg3n9EJ8tyf1vaguT-jv15klc,30243
@@ -182,7 +178,7 @@ fprime_gds/flask/static/img/error.svg,sha256=dJOAFEQ_DlLvJg-fBuBGDCBua8rbvSzmY3l
182
178
  fprime_gds/flask/static/img/logo.svg,sha256=czqCyVnhqFEw7qsKDMm63w959Pa77nYqY7GyoHVGcZ4,12470
183
179
  fprime_gds/flask/static/img/success.svg,sha256=wCfYG4cPfSCcsZ76JI4SwAJ-y62rahx9rJXyB-2qDIY,1757
184
180
  fprime_gds/flask/static/js/config.js,sha256=3CNrVmUtUGeiomAuoAE22w34r7wA-X0OtXN3JtLZYJ8,1066
185
- fprime_gds/flask/static/js/datastore.js,sha256=mx0ZaUq-Nlb2LParYfnhu0WMUH-JGKKKgRQD_nOcZNE,15437
181
+ fprime_gds/flask/static/js/datastore.js,sha256=AAJKRQbcvQuS-4OScad5zBfYjHljDrjsL5RnTcXx39A,15508
186
182
  fprime_gds/flask/static/js/gds.js,sha256=OeDJrNmNA8hUPi8QIHP-s33MW_IYT3QIccxzL75MsjA,1297
187
183
  fprime_gds/flask/static/js/json.js,sha256=kfwzTqoyLu_Feqcp9WEhDWpZ3lziwHy9LGkOg8PCo6s,12429
188
184
  fprime_gds/flask/static/js/loader.js,sha256=IbuJ7Jh70umyZog0iIupOuRGwc1tO5thT88jTW0XZc4,11414
@@ -228,10 +224,10 @@ fprime_gds/flask/static/third-party/webfonts/fa-solid-900.woff2,sha256=mDS4KtJuK
228
224
  fprime_gds/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
225
  fprime_gds/plugin/definitions.py,sha256=5rHGSOrr62qRNVfX9bZIo4HDAKG62lKteNum9G40y3g,2347
230
226
  fprime_gds/plugin/system.py,sha256=uWd6DVW90Re0FoNMPNCx0cXXTJUdpgAAO0mtakzRNgk,8564
231
- fprime_gds-3.6.1.dist-info/LICENSE.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
232
- fprime_gds-3.6.1.dist-info/METADATA,sha256=nxDoqKpYEs-Fv2wpXgiNUpmT1D0fjvGHsYgqjqJT7Hs,24770
233
- fprime_gds-3.6.1.dist-info/NOTICE.txt,sha256=vXjA_xRcQhd83Vfk5D_vXg5kOjnnXvLuMi5vFKDEVmg,1612
234
- fprime_gds-3.6.1.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
235
- fprime_gds-3.6.1.dist-info/entry_points.txt,sha256=oqUiO3xhJCR943jdU3zcxbqEvSXNeVgshk7dVaf_nGY,322
236
- fprime_gds-3.6.1.dist-info/top_level.txt,sha256=6vzFLIX6ANfavKaXFHDMSLFtS94a6FaAsIWhjgYuSNE,27
237
- fprime_gds-3.6.1.dist-info/RECORD,,
227
+ fprime_gds-3.6.2a1.dist-info/LICENSE.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
228
+ fprime_gds-3.6.2a1.dist-info/METADATA,sha256=R_nYB3RORZOSvgkK0I7hoDumeAymhEUbrWEvQpKXpjE,24772
229
+ fprime_gds-3.6.2a1.dist-info/NOTICE.txt,sha256=vXjA_xRcQhd83Vfk5D_vXg5kOjnnXvLuMi5vFKDEVmg,1612
230
+ fprime_gds-3.6.2a1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
231
+ fprime_gds-3.6.2a1.dist-info/entry_points.txt,sha256=oqUiO3xhJCR943jdU3zcxbqEvSXNeVgshk7dVaf_nGY,322
232
+ fprime_gds-3.6.2a1.dist-info/top_level.txt,sha256=6vzFLIX6ANfavKaXFHDMSLFtS94a6FaAsIWhjgYuSNE,27
233
+ fprime_gds-3.6.2a1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.1)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,79 +0,0 @@
1
- """
2
- @brief Loader class for importing python based channel dictionaries
3
-
4
- @date Created July 11, 2018
5
- @author R. Joseph Paetz
6
-
7
- @bug No known bugs
8
- """
9
-
10
- from fprime_gds.common.templates.ch_template import ChTemplate
11
-
12
- # Custom Python Modules
13
- from .python_loader import PythonLoader
14
-
15
-
16
- class ChPyLoader(PythonLoader):
17
- """Class to load python based telemetry channel dictionaries"""
18
-
19
- # Field names in the python module files (used to construct dictionaries)
20
- ID_FIELD = "ID"
21
- NAME_FIELD = "NAME"
22
- COMP_FIELD = "COMPONENT"
23
- DESC_FIELD = "CHANNEL_DESCRIPTION"
24
- TYPE_FIELD = "TYPE"
25
- FMT_STR_FIELD = "FORMAT_STRING"
26
- LOW_R_FIELD = "LOW_RED"
27
- LOW_O_FIELD = "LOW_ORANGE"
28
- LOW_Y_FIELD = "LOW_YELLOW"
29
- HIGH_Y_FIELD = "HIGH_YELLOW"
30
- HIGH_O_FIELD = "HIGH_ORANGE"
31
- HIGH_R_FIELD = "HIGH_RED"
32
-
33
- def construct_dicts(self, path):
34
- """
35
- Constructs and returns python dictionaries keyed on id and name
36
-
37
- This function should not be called directly, instead, use
38
- get_id_dict(path) and get_name_dict(path)
39
-
40
- Args:
41
- path: Path to the python module file dictionary to convert. This
42
- should be a directory. If using a regular fprime deployment,
43
- this should be a path to the events dictionary in your
44
- generated folder:
45
- ${GENERATED_FOLDER_LOCATION}/generated/${DEPLOYMENT}/channels
46
-
47
- Returns:
48
- A tuple with two channel dictionaries (python type dict):
49
- (id_dict, name_dict). The keys should be the channels' id and
50
- name fields respectively and the values should be ChTemplate
51
- objects.
52
- """
53
- # We do need it sometimes, so if we don't always set it to true, we will need to pass an arg
54
- module_dicts = self.read_dict(path, use_superpkg=True)
55
-
56
- id_dict = {}
57
- name_dict = {}
58
-
59
- for ch_dict in module_dicts:
60
- # Create a channel template object
61
- ch_temp = ChTemplate(
62
- ch_dict[self.ID_FIELD],
63
- ch_dict[self.NAME_FIELD],
64
- ch_dict[self.COMP_FIELD],
65
- ch_dict[self.TYPE_FIELD],
66
- ch_dict[self.FMT_STR_FIELD],
67
- ch_dict[self.DESC_FIELD],
68
- ch_dict[self.LOW_R_FIELD],
69
- ch_dict[self.LOW_O_FIELD],
70
- ch_dict[self.LOW_Y_FIELD],
71
- ch_dict[self.HIGH_Y_FIELD],
72
- ch_dict[self.HIGH_O_FIELD],
73
- ch_dict[self.HIGH_R_FIELD],
74
- )
75
-
76
- id_dict[ch_dict[self.ID_FIELD]] = ch_temp
77
- name_dict[ch_dict[self.NAME_FIELD]] = ch_temp
78
-
79
- return id_dict, name_dict
@@ -1,66 +0,0 @@
1
- """
2
- @brief Loader class for importing python based command dictionaries
3
-
4
- @date Created July 9, 2018
5
- @author R. Joseph Paetz
6
-
7
- @bug No known bugs
8
- """
9
-
10
- from fprime_gds.common.templates import cmd_template
11
-
12
- # Custom Python Modules
13
- from . import python_loader
14
-
15
-
16
- class CmdPyLoader(python_loader.PythonLoader):
17
- """Class to load python based command dictionaries"""
18
-
19
- # Field names in the python module file dictionaries
20
- COMPONENT_FIELD = "COMPONENT"
21
- MNEMONIC_FIELD = "MNEMONIC"
22
- OP_CODE_FIELD = "OP_CODE"
23
- DESC_FIELD = "CMD_DESCRIPTION"
24
- ARGS_FIELD = "ARGUMENTS"
25
-
26
- def construct_dicts(self, path):
27
- """
28
- Constructs and returns python dictionaries keyed on id and name
29
-
30
- This function should not be called directly, instead use
31
- get_id_dict(path) and get_name_dict(path) defined in the base Loader
32
- class. For the command dictionary, the op_code is treated as the ID and
33
- the command mnemonic is treated as the name.
34
-
35
- Args:
36
- path: Path to the python module file dictionary to convert. This
37
- should be a directory. If using a regular fprime deployment,
38
- this should be a path to the events dictionary in your
39
- generated folder:
40
- ${GENERATED_FOLDER_LOCATION}/generated/${DEPLOYMENT}/events
41
-
42
- Returns:
43
- A tuple with two event dictionaries (python type dict):
44
- (id_dict, name_dict). They should have keys of the id and name
45
- fields respectively and the values for both should be event_template
46
- objects.
47
- """
48
- module_dicts = self.read_dict(path, use_superpkg=True)
49
-
50
- id_dict = {}
51
- name_dict = {}
52
-
53
- for cmd_dict in module_dicts:
54
- # Create a cmd template object
55
- cmd_temp = cmd_template.CmdTemplate(
56
- cmd_dict[self.OP_CODE_FIELD],
57
- cmd_dict[self.MNEMONIC_FIELD],
58
- cmd_dict[self.COMPONENT_FIELD],
59
- cmd_dict[self.ARGS_FIELD],
60
- cmd_dict[self.DESC_FIELD],
61
- )
62
-
63
- id_dict[cmd_dict[self.OP_CODE_FIELD]] = cmd_temp
64
- name_dict[cmd_dict[self.MNEMONIC_FIELD]] = cmd_temp
65
-
66
- return id_dict, name_dict
@@ -1,75 +0,0 @@
1
- """
2
- @brief Loader class for importing python based event dictionaries
3
-
4
- @date Created July 3, 2018
5
- @author R. Joseph Paetz
6
-
7
- @bug No known bugs
8
- """
9
-
10
- from fprime.common.models.serialize.type_exceptions import TypeMismatchException
11
-
12
- from fprime_gds.common.templates import event_template
13
- from fprime_gds.common.utils.event_severity import EventSeverity
14
-
15
- # Custom Python Modules
16
- from . import python_loader
17
-
18
-
19
- class EventPyLoader(python_loader.PythonLoader):
20
- """Class to load python based event dictionaries"""
21
-
22
- # Field names in the python module file dictionaries
23
- ID_FIELD = "ID"
24
- NAME_FIELD = "NAME"
25
- COMP_FIELD = "COMPONENT"
26
- SEVERITY_FIELD = "SEVERITY"
27
- FMT_STR_FIELD = "FORMAT_STRING"
28
- DESC_FIELD = "EVENT_DESCRIPTION"
29
- ARGS_FIELD = "ARGUMENTS"
30
-
31
- def construct_dicts(self, path):
32
- """
33
- Constructs and returns python dictionaries keyed on id and name
34
-
35
- This function should not be called directly, instead use
36
- get_id_dict(path) and get_name_dict(path)
37
-
38
- Args:
39
- path: Path to the python module file dictionary to convert. This
40
- should be a directory. If using a regular fprime deployment,
41
- this should be a path to the events dictionary in your
42
- generated folder:
43
- ${GENERATED_FOLDER_LOCATION}/generated/${DEPLOYMENT}/events
44
-
45
- Returns:
46
- A tuple with two event dictionaries (python type dict):
47
- (id_dict, name_dict). The keys should be the events' id and name
48
- fields respectively and the values should be EventTemplate
49
- objects.
50
- """
51
- module_dicts = self.read_dict(path, use_superpkg=True)
52
-
53
- id_dict = {}
54
- name_dict = {}
55
-
56
- for event_dict in module_dicts:
57
-
58
- try:
59
- # Create an event template object
60
- event_temp = event_template.EventTemplate(
61
- event_dict[self.ID_FIELD],
62
- event_dict[self.NAME_FIELD],
63
- event_dict[self.COMP_FIELD],
64
- event_dict[self.ARGS_FIELD],
65
- EventSeverity[event_dict[self.SEVERITY_FIELD]],
66
- event_dict[self.FMT_STR_FIELD],
67
- event_dict[self.DESC_FIELD],
68
- )
69
- id_dict[event_dict[self.ID_FIELD]] = event_temp
70
- name_dict[event_dict[self.NAME_FIELD]] = event_temp
71
- except TypeMismatchException as error:
72
- print(f"Type mismatch: {error.getMsg()}")
73
- raise error
74
-
75
- return id_dict, name_dict
@@ -1,132 +0,0 @@
1
- """
2
- @brief Base class for all loaders that load dictionaries of python fragments
3
-
4
- The PythonLoader class inherits from the DictLoader base class and is intended
5
- to be inherited by all loader classes that read dictionaries in the file system
6
- made up of multiple python file fragments.
7
-
8
- This Class only adds helper functions and thus does not overwrite any methods in
9
- in the base DictLoader class. Because of this, all dictionaries returned from
10
- this class will be empty.
11
-
12
- @date Created July 3, 2018
13
- @author R. Joseph Paetz
14
-
15
- @bug No known bugs
16
- """
17
-
18
- import glob
19
- import importlib
20
- import os
21
- import sys
22
-
23
- from fprime_gds.common.data_types import exceptions
24
-
25
- # Custom Python Modules
26
- from . import dict_loader
27
-
28
-
29
- class PythonLoader(dict_loader.DictLoader):
30
- """Class to help load python file based dictionaries"""
31
-
32
- def read_dict(self, path, use_superpkg=False):
33
- """
34
- Reads all python modules at the given path and constructs a dict list
35
-
36
- This function assumes that path is a directory containing many python
37
- module files. Each module file has several fields with associated
38
- values. This function reads each file and constructs a dictionary using
39
- the fields and their values. These dictionaries are then compiled into
40
- a list that is returned.
41
-
42
- Args:
43
- path: File Path to a folder containing python modules to load
44
- use_superpkg: [Default=False] When true, modules will be imported
45
- using both the package and superpackage qualifiers
46
- (from A.B import C instead of from B import C). This
47
- allows multiple dictionaries with the same package
48
- name to be imported. This is especially important
49
- when trying to import dictionaries from multiple
50
- deployments.
51
-
52
- Returns:
53
- A list of dictionaries. Each dictionary represents one loaded module
54
- and for keys has the names of the fields in the file and for values
55
- has the values of those fields.
56
- """
57
- modules = self.import_modules(path, use_superpkg)
58
-
59
- module_dicts = []
60
- for module in modules:
61
- # Create a dictionary for this module's fields
62
- mod_dict = {
63
- field: getattr(module, field)
64
- for field in dir(module)
65
- if field.find("__") != 0 # Verify it is not a hidden field (doesn't start with "__")
66
- }
67
-
68
- module_dicts.append(mod_dict)
69
-
70
- return module_dicts
71
-
72
- @staticmethod
73
- def import_modules(path, use_superpkg):
74
- """
75
- Imports all modules in the given directory.
76
-
77
- Args:
78
- path: File Path to a folder containing python modules to load
79
- use_superpkg: When true, modules will be imported
80
- using both the package and superpackage qualifiers
81
- (from A.B import C instead of from B import C). This
82
- allows multiple dictionaries with the same package
83
- name to be imported. This is especially important
84
- when trying to import dictionaries from multiple
85
- deployments.
86
-
87
- Returns:
88
- A list of module objects of all the newly imported modules
89
- """
90
- # Verify path is a directory
91
- if not os.path.isdir(path):
92
- raise exceptions.GseControllerUndefinedDirectoryException(path)
93
-
94
- # Compute package and superpackage names
95
- (superpkg_path, pkg) = os.path.split(path)
96
- (rest_of_path, superpkg) = os.path.split(superpkg_path)
97
-
98
- # Make sure the directory we are importing from is in the python path
99
- if use_superpkg:
100
- sys.path.append(rest_of_path)
101
- else:
102
- sys.path.append(superpkg_path)
103
-
104
- # Make sure serializable directory is imported
105
- sys.path.append(superpkg_path + os.sep + "serializable")
106
-
107
- # Compute a list of all files to import
108
- all_files = glob.glob(path + os.sep + "*.py")
109
-
110
- module_files = []
111
- for py_file in all_files:
112
- (file_path, file_name) = os.path.split(py_file)
113
- if file_name != "__init__.py":
114
- module_files.append(file_name)
115
-
116
- # Import modules
117
- module_list = []
118
- for mf in module_files:
119
- # Strip off .py from name by splitting at '.' and taking the first
120
- # string
121
- mod_name = mf.split(".")[0]
122
-
123
- if use_superpkg:
124
- import_name = f"{superpkg}.{pkg}.{mod_name}"
125
- else:
126
- import_name = f"{pkg}.{mod_name}"
127
-
128
- m = importlib.import_module(import_name)
129
-
130
- module_list.append(m)
131
-
132
- return module_list