py-eb-model 1.0.0__py3-none-any.whl → 1.0.1__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.
- eb_model/cli/os_xdm_2_xls_cli.py +3 -2
- eb_model/cli/rte_xdm_2_xls_cli.py +68 -0
- eb_model/models/abstract.py +29 -11
- eb_model/models/eb_doc.py +7 -9
- eb_model/models/os_xdm.py +668 -96
- eb_model/models/rte_xdm.py +556 -0
- eb_model/parser/eb_parser.py +63 -30
- eb_model/parser/eb_parser_factory.py +29 -0
- eb_model/parser/os_xdm_parser.py +126 -27
- eb_model/parser/rte_xdm_parser.py +64 -0
- eb_model/reporter/excel_reporter/abstract.py +11 -11
- eb_model/reporter/excel_reporter/os_xdm.py +84 -2
- eb_model/reporter/excel_reporter/rte_xdm.py +87 -0
- eb_model/tests/models/test_eb_model.py +5 -0
- py_eb_model-1.0.1.dist-info/METADATA +94 -0
- {py_eb_model-1.0.0.dist-info → py_eb_model-1.0.1.dist-info}/RECORD +20 -15
- {py_eb_model-1.0.0.dist-info → py_eb_model-1.0.1.dist-info}/entry_points.txt +1 -0
- py_eb_model-1.0.0.dist-info/METADATA +0 -16
- {py_eb_model-1.0.0.dist-info → py_eb_model-1.0.1.dist-info}/LICENSE +0 -0
- {py_eb_model-1.0.0.dist-info → py_eb_model-1.0.1.dist-info}/WHEEL +0 -0
- {py_eb_model-1.0.0.dist-info → py_eb_model-1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
from ...models.rte_xdm import RteBswEventToTaskMapping, RteBswModuleInstance, RteEventToTaskMapping, RteSwComponentInstance
|
2
|
+
from ...models.eb_doc import EBModel
|
3
|
+
from .abstract import ExcelReporter
|
4
|
+
|
5
|
+
class RteXdmXlsWriter(ExcelReporter):
|
6
|
+
def __init__(self) -> None:
|
7
|
+
super().__init__()
|
8
|
+
|
9
|
+
def write_os_tasks(self, doc: EBModel):
|
10
|
+
sheet = self.wb.create_sheet("OsTask", 0)
|
11
|
+
|
12
|
+
title_row = ["Name", "OsTaskActivation", "OsTaskPriority", "OsTaskSchedule", "OsStacksize"]
|
13
|
+
self.write_title_row(sheet, title_row)
|
14
|
+
|
15
|
+
row = 2
|
16
|
+
for os_task in doc.getOs().getOsTaskList():
|
17
|
+
self.write_cell(sheet, row, 1, os_task.getName())
|
18
|
+
self.write_cell(sheet, row, 2, os_task.getOsTaskActivation())
|
19
|
+
self.write_cell(sheet, row, 3, os_task.getOsTaskPriority())
|
20
|
+
self.write_cell(sheet, row, 4, os_task.getOsTaskSchedule())
|
21
|
+
self.write_cell(sheet, row, 5, os_task.getOsStacksize())
|
22
|
+
row += 1
|
23
|
+
|
24
|
+
self.auto_width(sheet)
|
25
|
+
|
26
|
+
def write_os_isrs(self, doc: EBModel):
|
27
|
+
sheet = self.wb.create_sheet("OsIsr", 0)
|
28
|
+
|
29
|
+
title_row = ["Name", "OsIsrCategory", "OsStacksize"]
|
30
|
+
self.write_title_row(sheet, title_row)
|
31
|
+
|
32
|
+
row = 2
|
33
|
+
for os_isr in doc.getOs().getOsIsrList():
|
34
|
+
self.write_cell(sheet, row, 1, os_isr.getName())
|
35
|
+
self.write_cell(sheet, row, 2, os_isr.getOsIsrCategory())
|
36
|
+
self.write_cell(sheet, row, 3, os_isr.getOsStacksize())
|
37
|
+
row += 1
|
38
|
+
|
39
|
+
self.auto_width(sheet)
|
40
|
+
|
41
|
+
def write(self, filename, doc: EBModel):
|
42
|
+
self.logger.info("Writing <%s>" % filename)
|
43
|
+
self.write_os_tasks(doc)
|
44
|
+
self.write_os_isrs(doc)
|
45
|
+
|
46
|
+
self.save(filename)
|
47
|
+
|
48
|
+
class RteRunnableEntityXlsWriter(ExcelReporter):
|
49
|
+
def __init__(self) -> None:
|
50
|
+
super().__init__()
|
51
|
+
|
52
|
+
def write_mapped_events(self, doc: EBModel):
|
53
|
+
sheet = self.wb.create_sheet("Event Mapping", 0)
|
54
|
+
|
55
|
+
title_row = ["OsTask", "Event", "Event Type", "Executable Entity", "Instance", "Position", "Offset"]
|
56
|
+
self.write_title_row(sheet, title_row)
|
57
|
+
|
58
|
+
row = 2
|
59
|
+
for os_task, mappings in doc.getRte().getMappedEvents().items():
|
60
|
+
for mapping in sorted(mappings, key = lambda a:a.getRtePositionInTask()):
|
61
|
+
self.write_cell(sheet, row, 1, os_task)
|
62
|
+
if isinstance(mapping, RteBswEventToTaskMapping):
|
63
|
+
self.logger.debug("Write Mapping %s" % mapping.getName())
|
64
|
+
instance = mapping.getRteBswModuleInstance()
|
65
|
+
self.write_cell(sheet, row, 2, mapping.getRteBswEventRef().getShortName())
|
66
|
+
self.write_cell(sheet, row, 5, instance.getRteBswImplementationRef().getValue())
|
67
|
+
self.write_cell(sheet, row, 6, mapping.getRteBswPositionInTask())
|
68
|
+
self.write_cell(sheet, row, 7, mapping.getRteBswActivationOffset())
|
69
|
+
elif isinstance(mapping, RteEventToTaskMapping):
|
70
|
+
self.logger.debug("Write Mapping %s" % mapping.getName())
|
71
|
+
instance = mapping.getRteSwComponentInstance()
|
72
|
+
self.write_cell(sheet, row, 2, mapping.getRteEventRef().getShortName())
|
73
|
+
self.write_cell(sheet, row, 5, instance.getRteSoftwareComponentInstanceRef().getValue())
|
74
|
+
self.write_cell(sheet, row, 6, mapping.getRtePositionInTask())
|
75
|
+
self.write_cell(sheet, row, 7, mapping.getRteActivationOffset())
|
76
|
+
else:
|
77
|
+
raise NotImplementedError("Invalid Rte Event To Task Mapping <%s>" % type(mapping))
|
78
|
+
|
79
|
+
row += 1
|
80
|
+
|
81
|
+
self.auto_width(sheet)
|
82
|
+
|
83
|
+
def write(self, filename, doc: EBModel):
|
84
|
+
self.logger.info("Writing <%s>" % filename)
|
85
|
+
self.write_mapped_events(doc)
|
86
|
+
|
87
|
+
self.save(filename)
|
@@ -23,3 +23,8 @@ class TestEBModel:
|
|
23
23
|
document = EBModel.getInstance()
|
24
24
|
os = document.getOs()
|
25
25
|
assert (os.getFullName() == "/Os/Os")
|
26
|
+
|
27
|
+
def test_ebmodel_get_rte(self):
|
28
|
+
document = EBModel.getInstance()
|
29
|
+
rte = document.getRte()
|
30
|
+
assert (rte.getFullName() == "/Rte/Rte")
|
@@ -0,0 +1,94 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: py-eb-model
|
3
|
+
Version: 1.0.1
|
4
|
+
Summary: The parser for EB XDM file
|
5
|
+
Home-page: UNKNOWN
|
6
|
+
Author: melodypapa
|
7
|
+
Author-email: melodypapa@outlook.com
|
8
|
+
License: proprietary
|
9
|
+
Keywords: EB Tresos XDM
|
10
|
+
Platform: UNKNOWN
|
11
|
+
Classifier: Development Status :: 1 - Planning
|
12
|
+
Classifier: Environment :: Console
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
15
|
+
Classifier: Operating System :: OS Independent
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
Requires-Dist: openpyxl
|
18
|
+
Provides-Extra: pytest
|
19
|
+
Requires-Dist: pytest-cov ; extra == 'pytest'
|
20
|
+
|
21
|
+
# 1. py-eb-model
|
22
|
+
|
23
|
+
1. The python parser engine for EB Tresos Xdm file.
|
24
|
+
2. To support EB Tresos data model with python.
|
25
|
+
|
26
|
+
# 2. How to create the distribution and upload to pypi
|
27
|
+
|
28
|
+
1. Run `python setup.py bdist_wheel` to generate distribution
|
29
|
+
2. Run `twine check dist/*` to check the validation of distribution
|
30
|
+
3. Run `twine upload dist/*` to upload to pypi repository
|
31
|
+
4. Check the website https://pypi.org/project/armodel/ to find out it works or not
|
32
|
+
|
33
|
+
And more details can be found at https://packaging.python.org/
|
34
|
+
|
35
|
+
# 3. CLI
|
36
|
+
|
37
|
+
## 3.1. os-task-xlsx
|
38
|
+
|
39
|
+
Extract the Os Task information from os.xdm and then report all to Excel file.
|
40
|
+
|
41
|
+
```bash
|
42
|
+
os-xdm-xlsx data/Os.xdm data/Os.xlsx
|
43
|
+
```
|
44
|
+
|
45
|
+
**Result:**
|
46
|
+
|
47
|
+
1. OsIsrs
|
48
|
+
|
49
|
+

|
50
|
+
|
51
|
+
1. OsTasks
|
52
|
+
|
53
|
+

|
54
|
+
|
55
|
+
3. OsScheduleTable
|
56
|
+
|
57
|
+

|
58
|
+
|
59
|
+
4. OsCounter
|
60
|
+
|
61
|
+

|
62
|
+
|
63
|
+
## 3.2. rte-task-xls
|
64
|
+
|
65
|
+
Extract the Rte Configuration information from rte.xdm and then report all to Excel file.
|
66
|
+
|
67
|
+
1. Export the Rte Configuration information to excel file
|
68
|
+
|
69
|
+
```bash
|
70
|
+
rte-xdm-xlsx data/Rte.xdm data/Rte.xlsx
|
71
|
+
```
|
72
|
+
|
73
|
+
2. Export the Runnable Entities information to excel file
|
74
|
+
|
75
|
+
```bash
|
76
|
+
rte-xdm-xlsx -r data/Rte.xdm data/Os.xdm data/Runnable.xlsx
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
# 4. Change History
|
81
|
+
|
82
|
+
**Version 0.8.0**
|
83
|
+
|
84
|
+
1. Create the basic model for EB xdm. (Issue #1)
|
85
|
+
2. Support to extract the Os Tasks/Isrs from EB xdm and store them in the excel files. (Issue #1)
|
86
|
+
|
87
|
+
**Version 1.0.1**
|
88
|
+
|
89
|
+
1. Change the attribute to start with lowercase
|
90
|
+
2. *read_ref_value* and *read_optional_ref_value* method returns EcucRefType.
|
91
|
+
3. Read the OsScheduleTable and export to excel
|
92
|
+
4. REad the OsCounter and export to excel
|
93
|
+
|
94
|
+
|
@@ -1,21 +1,26 @@
|
|
1
1
|
eb_model/__init__.py,sha256=u3VUin2V_1eExLd9NIpw_LGHIAwaG2vEoyhssZurrvM,69
|
2
2
|
eb_model/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
eb_model/cli/os_xdm_2_xls_cli.py,sha256=
|
3
|
+
eb_model/cli/os_xdm_2_xls_cli.py,sha256=lTIYNVDDMIKu6sosjV8I3pLQxD-I11cKjUDXTyKDrLE,1643
|
4
|
+
eb_model/cli/rte_xdm_2_xls_cli.py,sha256=83uzE2Vk0h267gWxF9mnWN3Bh69RJpYyKULFXpxTByY,2127
|
4
5
|
eb_model/models/__init__.py,sha256=_WDgFMwl8w3WnI4ZpjHXMdJVdmqPRpwJ8GLMb4_RGk0,71
|
5
|
-
eb_model/models/abstract.py,sha256=
|
6
|
-
eb_model/models/eb_doc.py,sha256=
|
7
|
-
eb_model/models/os_xdm.py,sha256=
|
6
|
+
eb_model/models/abstract.py,sha256=4jy328yy2sedIHNwfxjzW3CnVsnTCoskatT8JXjv-rE,2402
|
7
|
+
eb_model/models/eb_doc.py,sha256=wWMHdLYpyvmEVlgNLzFLvC8C_uGnlPP4xnx_DlkslY4,1417
|
8
|
+
eb_model/models/os_xdm.py,sha256=KouM8Gh4ELl7oQUcgeQ-3Sm1gk4GhTOVZUNt25Rvowo,25163
|
9
|
+
eb_model/models/rte_xdm.py,sha256=8nYX567TgOH6BzsgaNOd2WTPGCxETTYXO9MQICrfCfQ,19328
|
8
10
|
eb_model/parser/__init__.py,sha256=5qHXKEfEMcE0WvvinJQu_21bNzWFdXTJxUudy-85DEE,40
|
9
|
-
eb_model/parser/eb_parser.py,sha256=
|
10
|
-
eb_model/parser/
|
11
|
+
eb_model/parser/eb_parser.py,sha256=H5NTDdM0DaGiHsZ6VjaA1pKla5mDePmTDp1jjbeFAbE,7057
|
12
|
+
eb_model/parser/eb_parser_factory.py,sha256=zqsqq52uImU4-WcS5dvHfhM95hiEPAGRtNzVik8i8wc,971
|
13
|
+
eb_model/parser/os_xdm_parser.py,sha256=rczz4YjDzCqNhOb4xAlGLfmWhIMBT9fQ6tSDmIk9kRs,8405
|
14
|
+
eb_model/parser/rte_xdm_parser.py,sha256=VbzrowPLpSww8E-Zl--aKTJ9ltHaZ9-wlVGL1nF79FE,4029
|
11
15
|
eb_model/reporter/__init__.py,sha256=H8D_23UwJi1Ph6yjBfZhxWVbu9ci5_O4471gqXGiZCM,36
|
12
16
|
eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtbK-w,1647
|
13
17
|
eb_model/reporter/excel_reporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
eb_model/reporter/excel_reporter/abstract.py,sha256=
|
15
|
-
eb_model/reporter/excel_reporter/os_xdm.py,sha256=
|
18
|
+
eb_model/reporter/excel_reporter/abstract.py,sha256=PfIoiKNKy1eRJBABln7rADkSdwWzS03Vs03jBYM-_5Y,1622
|
19
|
+
eb_model/reporter/excel_reporter/os_xdm.py,sha256=n1e-tU04s0oh3v31OUKgkIju6BUAtCwb7iGtp2j4Hsc,5578
|
20
|
+
eb_model/reporter/excel_reporter/rte_xdm.py,sha256=JweusBQJSg1_jaFbQV3sJnVMALMj3VuEkVf15Pw-Ir4,3936
|
16
21
|
eb_model/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
22
|
eb_model/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
eb_model/tests/models/test_eb_model.py,sha256=
|
23
|
+
eb_model/tests/models/test_eb_model.py,sha256=Xk7RAS4m038IhZ0Y1TQqVoJ-dWgJVIfXVJilWvVzXCw,962
|
19
24
|
eb_model/tests/models/test_ecuc_container.py,sha256=lZmtXwPMz9T52WFduTgFy16fO2agjSW-Rl2cVypM86s,722
|
20
25
|
py_eb_model/__init__.py,sha256=u3VUin2V_1eExLd9NIpw_LGHIAwaG2vEoyhssZurrvM,69
|
21
26
|
py_eb_model/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -32,9 +37,9 @@ py_eb_model/reporter/markdown.py,sha256=NhcJOFQ_BVbkgGe66uAT7KUPIchWU4kfVMtMLQtb
|
|
32
37
|
py_eb_model/reporter/excel_reporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
38
|
py_eb_model/reporter/excel_reporter/abstract.py,sha256=BOuLhWwwTwqBzErtmwPrelB1iByMfZP9haFmg9ayFQw,1488
|
34
39
|
py_eb_model/reporter/excel_reporter/os_xdm.py,sha256=WGMxK0PYxi9J5fUZ-EeiiM8NBpIg2WyxRsrN-gK37YE,1589
|
35
|
-
py_eb_model-1.0.
|
36
|
-
py_eb_model-1.0.
|
37
|
-
py_eb_model-1.0.
|
38
|
-
py_eb_model-1.0.
|
39
|
-
py_eb_model-1.0.
|
40
|
-
py_eb_model-1.0.
|
40
|
+
py_eb_model-1.0.1.dist-info/LICENSE,sha256=I52rGS7W1IwAmYCUfqTpDaSHoFAdt7grcNiBhk-Z3eI,1088
|
41
|
+
py_eb_model-1.0.1.dist-info/METADATA,sha256=9Z-Evx5Ti6je_cIEhCiwJeYSux4bHJb1ZW5GdCu9wK0,2400
|
42
|
+
py_eb_model-1.0.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
43
|
+
py_eb_model-1.0.1.dist-info/entry_points.txt,sha256=vC-sGaF_j37QgkuYsJooGZBN1jnHYWQC4jehliu37fY,119
|
44
|
+
py_eb_model-1.0.1.dist-info/top_level.txt,sha256=DGBNh6YW_x4RF_UoLKW3cKqb2SLnmfuEIZlkTewR66A,9
|
45
|
+
py_eb_model-1.0.1.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: py-eb-model
|
3
|
-
Version: 1.0.0
|
4
|
-
Summary: The parser for EB XDM file
|
5
|
-
Home-page: UNKNOWN
|
6
|
-
Author: melodypapa
|
7
|
-
Author-email: melodypapa@outlook.com
|
8
|
-
License: proprietary
|
9
|
-
Platform: UNKNOWN
|
10
|
-
Requires-Dist: openpyxl
|
11
|
-
Provides-Extra: pytest
|
12
|
-
Requires-Dist: pytest-cov ; extra == 'pytest'
|
13
|
-
|
14
|
-
UNKNOWN
|
15
|
-
|
16
|
-
|
File without changes
|
File without changes
|
File without changes
|