robotransform 0.1.0__py3-none-any.whl → 0.1.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.
- robotransform/__init__.py +8 -3
- robotransform/__main__.py +4 -2
- robotransform/convert.py +17 -17
- robotransform/{main.py → utils.py} +1 -9
- {robotransform-0.1.0.dist-info → robotransform-0.1.1.dist-info}/METADATA +1 -1
- robotransform-0.1.1.dist-info/RECORD +15 -0
- {robotransform-0.1.0.dist-info → robotransform-0.1.1.dist-info}/WHEEL +1 -1
- robotransform-0.1.0.dist-info/RECORD +0 -15
- /robotransform/templates/{aadl.jinja → logical.aadl.jinja} +0 -0
- {robotransform-0.1.0.dist-info → robotransform-0.1.1.dist-info}/entry_points.txt +0 -0
robotransform/__init__.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
from robotransform.
|
|
2
|
-
from robotransform.convert import
|
|
1
|
+
from robotransform.utils import Store, MapleKStore
|
|
2
|
+
from robotransform.convert import generate_aadl, generate_messages_aadl, generate_logical_aadl
|
|
3
|
+
from robotransform.utils import write_output
|
|
4
|
+
|
|
3
5
|
__all__ = (
|
|
4
6
|
"Store",
|
|
5
7
|
"MapleKStore",
|
|
6
|
-
"
|
|
8
|
+
"generate_aadl",
|
|
9
|
+
"generate_messages_aadl",
|
|
10
|
+
"generate_logical_aadl",
|
|
11
|
+
"write_output",
|
|
7
12
|
)
|
robotransform/__main__.py
CHANGED
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
import arklog
|
|
7
7
|
|
|
8
|
-
from robotransform import Store,
|
|
8
|
+
from robotransform import Store, generate_aadl
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def main():
|
|
@@ -20,7 +20,9 @@ def main():
|
|
|
20
20
|
if args.path.exists():
|
|
21
21
|
arklog.debug(f"Path exists: ({args.path}).")
|
|
22
22
|
store = Store((args.path,))
|
|
23
|
-
|
|
23
|
+
messages, logical = generate_aadl(store)
|
|
24
|
+
arklog.info(messages)
|
|
25
|
+
arklog.info(logical)
|
|
24
26
|
else:
|
|
25
27
|
arklog.debug(f"Path does not exist: ({args.path.resolve()}).")
|
|
26
28
|
|
robotransform/convert.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import io
|
|
4
4
|
import re
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Optional, Union
|
|
6
|
+
from typing import Optional, Union, Tuple
|
|
7
7
|
|
|
8
8
|
from robotransform.aadl import (
|
|
9
9
|
AADLPackage,
|
|
@@ -20,7 +20,7 @@ from robotransform.aadl import (
|
|
|
20
20
|
SystemImplementation,
|
|
21
21
|
)
|
|
22
22
|
from robotransform.filters import type_to_aadl_type
|
|
23
|
-
from robotransform.
|
|
23
|
+
from robotransform.utils import get_template, Store
|
|
24
24
|
from robotransform.concepts import Package, StateMachineDef, ControllerDef, RoboticPlatformDef, Variable, Event, Module
|
|
25
25
|
|
|
26
26
|
_IDENTIFIER_RE = re.compile(r"[^0-9A-Za-z_]")
|
|
@@ -104,14 +104,13 @@ def _collect_defined_message_types(robo_packages: list[Package]) -> set[str]:
|
|
|
104
104
|
return names
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
def _render_messages(robo_packages: list[Package], aadl_packages: list[AADLPackage]
|
|
108
|
-
output: Optional[Union[io.TextIOBase, Path, str]]) -> str:
|
|
107
|
+
def _render_messages(robo_packages: list[Package], aadl_packages: list[AADLPackage]) -> str:
|
|
109
108
|
used_types = _collect_message_types(aadl_packages)
|
|
110
109
|
defined_types = _collect_defined_message_types(robo_packages)
|
|
111
110
|
extra_types = sorted(used_types - defined_types)
|
|
112
111
|
template = get_template("messages")
|
|
113
112
|
data = template.render(packages=robo_packages, extra_types=extra_types)
|
|
114
|
-
return
|
|
113
|
+
return data
|
|
115
114
|
|
|
116
115
|
|
|
117
116
|
def robocart_package_to_aadl_full(rc_pkg: "Package") -> AADLPackage:
|
|
@@ -440,25 +439,26 @@ def robocart_package_to_aadl_full(rc_pkg: "Package") -> AADLPackage:
|
|
|
440
439
|
return aadl_pkg
|
|
441
440
|
|
|
442
441
|
|
|
443
|
-
def
|
|
444
|
-
template_name: str = "aadl",
|
|
445
|
-
messages_output: Optional[Union[io.TextIOBase, Path, str]] = None) -> str:
|
|
446
|
-
# If a Store, render all packages inside it
|
|
442
|
+
def _aadl_packages_from_input(rc_input: Union[Package, Store]) -> tuple[list[Package], list[AADLPackage]]:
|
|
447
443
|
if hasattr(rc_input, "__iter__") and not isinstance(rc_input, Package):
|
|
448
444
|
robo_packages = list(rc_input.load().values())
|
|
449
445
|
packages = [robocart_package_to_aadl_full(pkg) for pkg in robo_packages]
|
|
450
446
|
else:
|
|
451
447
|
robo_packages = [rc_input]
|
|
452
448
|
packages = [robocart_package_to_aadl_full(rc_input)]
|
|
449
|
+
return robo_packages, packages
|
|
453
450
|
|
|
454
|
-
template = get_template(template_name)
|
|
455
|
-
data = template.render(packages=packages)
|
|
456
|
-
write_output(data, output)
|
|
457
451
|
|
|
458
|
-
|
|
459
|
-
|
|
452
|
+
def generate_logical_aadl(rc_input: Union[Package, Store]) -> str:
|
|
453
|
+
robo_packages, packages = _aadl_packages_from_input(rc_input)
|
|
454
|
+
return get_template("logical").render(packages=packages)
|
|
460
455
|
|
|
461
|
-
if messages_output is not None:
|
|
462
|
-
_render_messages(robo_packages, packages, messages_output)
|
|
463
456
|
|
|
464
|
-
|
|
457
|
+
def generate_messages_aadl(rc_input: Union[Package, Store]) -> str:
|
|
458
|
+
robo_packages, packages = _aadl_packages_from_input(rc_input)
|
|
459
|
+
return _render_messages(robo_packages, packages)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def generate_aadl(rc_input: Union[Package, Store]) -> Tuple[str, str]:
|
|
463
|
+
robo_packages, packages = _aadl_packages_from_input(rc_input)
|
|
464
|
+
return _render_messages(robo_packages, packages), get_template("logical").render(packages=packages)
|
|
@@ -114,7 +114,7 @@ def get_template(name: str) -> Template:
|
|
|
114
114
|
environment.filters["type_to_aadl_type"] = type_to_aadl_type # For use with pipes
|
|
115
115
|
templates = {
|
|
116
116
|
"messages": "messages.aadl.jinja",
|
|
117
|
-
"
|
|
117
|
+
"logical": "logical.aadl.jinja",
|
|
118
118
|
}
|
|
119
119
|
if found := templates.get(name):
|
|
120
120
|
return environment.get_template(found)
|
|
@@ -135,11 +135,3 @@ def write_output(data: str, output: Optional[Union[io.TextIOBase, Path, str]] =
|
|
|
135
135
|
else:
|
|
136
136
|
raise TypeError(f"Unsupported output type ({type(output)}).")
|
|
137
137
|
return data
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def main():
|
|
141
|
-
pass
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if __name__ == "__main__":
|
|
145
|
-
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
robotransform/__init__.py,sha256=LbzuUkjjxPEmbNUWotP0nGVG5ucIxj1HR7bSKV0NmAA,338
|
|
2
|
+
robotransform/__main__.py,sha256=-4PUIeWy_o6h-KXU2IOXPbJY5lXMf55Qey1WLRBqzFg,691
|
|
3
|
+
robotransform/aadl.py,sha256=tPlmiSltLSbC8kqU-FlxyDPdcdTjUT4rKHwEweFgBow,6664
|
|
4
|
+
robotransform/concepts.py,sha256=MXPff6XwQyabWJcSC5armw3eI4xGDmnd6yZpmHdO6m8,9933
|
|
5
|
+
robotransform/convert.py,sha256=wW0V2PZJFkNz6mTv5sGqScnR4NYC4cRu-0aL2Ec4KOY,18832
|
|
6
|
+
robotransform/filters.py,sha256=uEG2xs-gvtxpmyItbXtjLeOXgCJlACbPgAL1Hi2n5iE,838
|
|
7
|
+
robotransform/processors.py,sha256=8NaNFTAm3iaNAzbp5D8-Uv_qIWyxVklIbmGtXi5--nM,1578
|
|
8
|
+
robotransform/robochart.tx,sha256=lM4ooS8jvb949q20X4t6jZzh1M3VCtlxUORlWS3GA4w,10229
|
|
9
|
+
robotransform/templates/logical.aadl.jinja,sha256=7BHQvBPsJby5XSmiqEXd8mrQwEdSG3WPtwzcDu8WSlY,424
|
|
10
|
+
robotransform/templates/messages.aadl.jinja,sha256=1EOMiBE-Lh5FWnfjSsVoICDU_-ZcgFEY1sMasXP5k00,530
|
|
11
|
+
robotransform/utils.py,sha256=qNrjz5okBVe85XnGRg4rJds0RGhhsPOxWzuhnaLFoRw,4568
|
|
12
|
+
robotransform-0.1.1.dist-info/WHEEL,sha256=jROcLULcdzropX2J55opKw4UHhPFREZax2XzS-Mvpxs,80
|
|
13
|
+
robotransform-0.1.1.dist-info/entry_points.txt,sha256=NvmK-01oEE7ji06NbIxr7pZGUEJwbwMLjjfHssOVmB0,52
|
|
14
|
+
robotransform-0.1.1.dist-info/METADATA,sha256=vO_T_WZWJXBtAnvYIyas7kcrbfgerkXSXZNKBphDawc,42259
|
|
15
|
+
robotransform-0.1.1.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
robotransform/__init__.py,sha256=xvdDZSVP3mLi7gN7a2Qdtyvh-ZQ1YwXlIaGFvcb1Ulg,157
|
|
2
|
-
robotransform/__main__.py,sha256=PcaDvzku32_BZ3c9ODZMUJKveARGID3FGOq0XA60c7o,617
|
|
3
|
-
robotransform/aadl.py,sha256=tPlmiSltLSbC8kqU-FlxyDPdcdTjUT4rKHwEweFgBow,6664
|
|
4
|
-
robotransform/concepts.py,sha256=MXPff6XwQyabWJcSC5armw3eI4xGDmnd6yZpmHdO6m8,9933
|
|
5
|
-
robotransform/convert.py,sha256=KStKLUDAXD15j4-jzqIG-rga8c5WGB3J4URjAGuJvt0,18819
|
|
6
|
-
robotransform/filters.py,sha256=uEG2xs-gvtxpmyItbXtjLeOXgCJlACbPgAL1Hi2n5iE,838
|
|
7
|
-
robotransform/main.py,sha256=xrbu1Dal027VPAYSzRjHFqh7OuFHQZ_tkL_xz7lYFro,4620
|
|
8
|
-
robotransform/processors.py,sha256=8NaNFTAm3iaNAzbp5D8-Uv_qIWyxVklIbmGtXi5--nM,1578
|
|
9
|
-
robotransform/robochart.tx,sha256=lM4ooS8jvb949q20X4t6jZzh1M3VCtlxUORlWS3GA4w,10229
|
|
10
|
-
robotransform/templates/aadl.jinja,sha256=7BHQvBPsJby5XSmiqEXd8mrQwEdSG3WPtwzcDu8WSlY,424
|
|
11
|
-
robotransform/templates/messages.aadl.jinja,sha256=1EOMiBE-Lh5FWnfjSsVoICDU_-ZcgFEY1sMasXP5k00,530
|
|
12
|
-
robotransform-0.1.0.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
|
|
13
|
-
robotransform-0.1.0.dist-info/entry_points.txt,sha256=NvmK-01oEE7ji06NbIxr7pZGUEJwbwMLjjfHssOVmB0,52
|
|
14
|
-
robotransform-0.1.0.dist-info/METADATA,sha256=MwlUaGCSB2st_rvml5t5CzYM2oSmJ8U8LMNDYoYZ-h0,42259
|
|
15
|
-
robotransform-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|