clerk-sdk 0.2.7__py3-none-any.whl → 0.2.8__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.
- clerk/gui_automation/ui_actions/support.py +42 -1
- {clerk_sdk-0.2.7.dist-info → clerk_sdk-0.2.8.dist-info}/METADATA +1 -1
- {clerk_sdk-0.2.7.dist-info → clerk_sdk-0.2.8.dist-info}/RECORD +6 -6
- {clerk_sdk-0.2.7.dist-info → clerk_sdk-0.2.8.dist-info}/WHEEL +0 -0
- {clerk_sdk-0.2.7.dist-info → clerk_sdk-0.2.8.dist-info}/licenses/LICENSE +0 -0
- {clerk_sdk-0.2.7.dist-info → clerk_sdk-0.2.8.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ from datetime import timedelta, datetime
|
|
|
2
2
|
import os
|
|
3
3
|
import base64
|
|
4
4
|
import time
|
|
5
|
-
from typing import Optional
|
|
5
|
+
from typing import List, Optional
|
|
6
6
|
from backoff._typing import Details
|
|
7
7
|
|
|
8
8
|
from clerk.models.ui_operator import TaskStatuses, UiOperatorTask
|
|
@@ -60,6 +60,47 @@ def save_screenshot(filename: str, sub_folder: Optional[str] = None) -> str:
|
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
+
def try_actions(actions: List[BaseAction]):
|
|
64
|
+
"""
|
|
65
|
+
Executes a list of UI actions and handles any errors that occur.
|
|
66
|
+
|
|
67
|
+
This function takes a list of UI actions as input and executes them one by one.
|
|
68
|
+
If an action fails with a RuntimeError, it logs a warning message and moves on to the next action.
|
|
69
|
+
If all actions fail, it logs an error message and raises a RuntimeError.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
actions (List[BaseAction]): A list of UI actions to be executed.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
TypeError: If any of the actions in the list is not an instance of BaseAction.
|
|
76
|
+
RuntimeError: If all actions fail.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
None
|
|
80
|
+
|
|
81
|
+
Example Usage:
|
|
82
|
+
actions = [action1, action2, action3]
|
|
83
|
+
try_actions(actions)
|
|
84
|
+
"""
|
|
85
|
+
try:
|
|
86
|
+
assert all(isinstance(action, BaseAction) for action in actions)
|
|
87
|
+
for action in actions:
|
|
88
|
+
try:
|
|
89
|
+
action.do()
|
|
90
|
+
return
|
|
91
|
+
except RuntimeError as e:
|
|
92
|
+
logger.warning(
|
|
93
|
+
f"The action {action} was not performed successfully.\nDetails: {str(e)}",
|
|
94
|
+
)
|
|
95
|
+
# all the actions have failed. log an error and raise a runtime error
|
|
96
|
+
logger.error("All actions have failed.")
|
|
97
|
+
raise RuntimeError("All actions have failed")
|
|
98
|
+
except AssertionError as e:
|
|
99
|
+
raise TypeError(
|
|
100
|
+
f"All actions must be valid. Encountered invalid action: {str(e)}"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
63
104
|
def _format_action_string(action: BaseAction) -> str:
|
|
64
105
|
"""
|
|
65
106
|
Formats action in the same format as the one used in task modules.
|
|
@@ -23,7 +23,7 @@ clerk/gui_automation/exceptions/modality/exc.py,sha256=P-dMuCTyVZYD3pbGpCf_1SYEg
|
|
|
23
23
|
clerk/gui_automation/ui_actions/__init__.py,sha256=-EDQ5375HXrvG3sfFY7zOPC405YcBL6xXRACm2p-YyI,23
|
|
24
24
|
clerk/gui_automation/ui_actions/actions.py,sha256=hhxl5VMDNSXdqm2L0tZqs6IhJHVXtlSVSdwsiz2BbDI,27449
|
|
25
25
|
clerk/gui_automation/ui_actions/base.py,sha256=4CjOkMZNLt8W0tLO91tOkz8CCea0m2IRBIOpWNMOZUA,7230
|
|
26
|
-
clerk/gui_automation/ui_actions/support.py,sha256=
|
|
26
|
+
clerk/gui_automation/ui_actions/support.py,sha256=Ulb8DBfwnrBMaYoMLDgldEy9V--NDUSdhIYXpuODZoU,5772
|
|
27
27
|
clerk/gui_automation/ui_state_inspector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
clerk/gui_automation/ui_state_inspector/gui_vision.py,sha256=lRnF3IMLViOB-UE447A4kc8BO7NKqqLV1NZKRswRKWg,7707
|
|
29
29
|
clerk/gui_automation/ui_state_inspector/models.py,sha256=uuzYhE9is4Z-TmsVMA1mwf0mQGs_PDLqdSZKbe8dHSs,5691
|
|
@@ -43,8 +43,8 @@ clerk/models/ui_operator.py,sha256=mKTJUFZgv7PeEt5oys28HVZxHOJsofmRQOcRpqj0dbU,2
|
|
|
43
43
|
clerk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
clerk/utils/logger.py,sha256=_jYOSEc1WCsY9DvU8cIWUPmz41QNjpHTEZ7WrUnmFPA,3650
|
|
45
45
|
clerk/utils/save_artifact.py,sha256=Lwl3l3QqKnSFLFpfEEa-dJ-dV9OxvCU3ADkuYZ18U-Q,1117
|
|
46
|
-
clerk_sdk-0.2.
|
|
47
|
-
clerk_sdk-0.2.
|
|
48
|
-
clerk_sdk-0.2.
|
|
49
|
-
clerk_sdk-0.2.
|
|
50
|
-
clerk_sdk-0.2.
|
|
46
|
+
clerk_sdk-0.2.8.dist-info/licenses/LICENSE,sha256=GTVQl3vH6ht70wJXKC0yMT8CmXKHxv_YyO_utAgm7EA,1065
|
|
47
|
+
clerk_sdk-0.2.8.dist-info/METADATA,sha256=IrsGA9xl2v4g6Pyai2o09RWSl8AyoeWRekLNDfFUu3o,3508
|
|
48
|
+
clerk_sdk-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
49
|
+
clerk_sdk-0.2.8.dist-info/top_level.txt,sha256=99eQiU6d05_-f41tmSFanfI_SIJeAdh7u9m3LNSfcv4,6
|
|
50
|
+
clerk_sdk-0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|