-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marco Lampacrescia <[email protected]>
- Loading branch information
1 parent
1be3385
commit f5e0e9d
Showing
6 changed files
with
70 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
scxml_converter/src/scxml_converter/scxml_entries/utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Get the resolved types from the forward references in ScxmlExecutableEntry | ||
_ResolvedScxmlExecutableEntry = \ | ||
tuple(entry._evaluate(globals(), locals(), frozenset()) | ||
for entry in get_args(ScxmlExecutableEntry)) | ||
|
||
|
||
def valid_execution_body(execution_body: ScxmlExecutionBody) -> bool: | ||
""" | ||
Check if an execution body is valid. | ||
:param execution_body: The execution body to check | ||
:return: True if the execution body is valid, False otherwise | ||
""" | ||
valid = isinstance(execution_body, list) | ||
if not valid: | ||
print("Error: SCXML execution body: invalid type found: expected a list.") | ||
for entry in execution_body: | ||
if not isinstance(entry, _ResolvedScxmlExecutableEntry): | ||
valid = False | ||
print(f"Error: SCXML execution body: entry type {type(entry)} not in valid set " | ||
f" {_ResolvedScxmlExecutableEntry}.") | ||
break | ||
if not entry.check_validity(): | ||
valid = False | ||
print("Error: SCXML execution body: invalid entry content found.") | ||
break | ||
return valid | ||
|
||
|
||
def execution_body_from_xml(xml_tree: ET.ElementTree) -> ScxmlExecutionBody: | ||
""" | ||
Create an execution body from an XML tree. | ||
:param xml_tree: The XML tree to create the execution body from | ||
:return: The execution body | ||
""" | ||
raise NotImplementedError("Not implemented yet.") |