-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python 3 Script - 414 - Updated the SDK | Updated Python version to 3…
….9.18 | Added handler to run function separately (#2125)
- Loading branch information
1 parent
40bf213
commit 68695c9
Showing
11 changed files
with
112 additions
and
34 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
3 changes: 3 additions & 0 deletions
3
plugins/python_3_script/icon_python_3_script/util/constants.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,3 @@ | ||
INDENTATION_CHARACTER = " " * 4 | ||
DEFAULT_ENCODING = "utf-8" | ||
DEFAULT_PROCESS_TIMEOUT = 5 * 60 |
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,29 @@ | ||
from typing import Any, Dict, Union | ||
|
||
import yaml | ||
|
||
|
||
def extract_output_from_stdout(input_stdout: str, output_prefix: str) -> Union[Dict[str, Any], None]: | ||
""" | ||
Extract output from a string representing standard output. | ||
This function parses the provided `input_stdout` string and extracts any output data | ||
that start with the specified `output_prefix`. The extracted output is returned as a | ||
dictionary where the keys are the extracted output lines without the prefix. | ||
:param input_stdout: The string representing the standard output to extract from. | ||
:type: str | ||
:param output_prefix: The prefix indicating the lines to extract from `input_stdout`. | ||
:type: str | ||
:return: A dictionary containing the extracted output. | ||
:rtype: Union[Dict[str, Any], None] | ||
""" | ||
|
||
if output_prefix in input_stdout: | ||
function_output = yaml.safe_load(input_stdout[input_stdout.index(output_prefix) + len(output_prefix) :]) | ||
if isinstance(function_output, str) and function_output.lower().strip() == "none": | ||
return None | ||
return function_output | ||
return None |
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
2 changes: 1 addition & 1 deletion
2
plugins/python_3_script/unit_test/inputs/run_no_credentials.json.inp
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