clerk-sdk 0.2.6__tar.gz → 0.2.8__tar.gz

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.
Files changed (59) hide show
  1. {clerk_sdk-0.2.6/clerk_sdk.egg-info → clerk_sdk-0.2.8}/PKG-INFO +1 -1
  2. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_actions/support.py +42 -1
  3. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -13
  4. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8/clerk_sdk.egg-info}/PKG-INFO +1 -1
  5. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/setup.py +1 -1
  6. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/LICENSE +0 -0
  7. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/MANIFEST.in +0 -0
  8. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/README.md +0 -0
  9. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/__init__.py +0 -0
  10. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/base.py +0 -0
  11. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/client.py +0 -0
  12. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/decorator/__init__.py +0 -0
  13. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/decorator/models.py +0 -0
  14. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/decorator/task_decorator.py +0 -0
  15. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/__init__.py +0 -0
  16. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/action_model/__init__.py +0 -0
  17. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/action_model/model.py +0 -0
  18. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/action_model/utils.py +0 -0
  19. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/client.py +0 -0
  20. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/client_actor/__init__.py +0 -0
  21. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/client_actor/client_actor.py +0 -0
  22. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/client_actor/exception.py +0 -0
  23. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/client_actor/model.py +0 -0
  24. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/decorators/__init__.py +0 -0
  25. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/decorators/gui_automation.py +0 -0
  26. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/exceptions/__init__.py +0 -0
  27. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
  28. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
  29. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
  30. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/exceptions/websocket.py +0 -0
  31. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/requirements.txt +0 -0
  32. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_actions/__init__.py +0 -0
  33. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_actions/actions.py +0 -0
  34. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_actions/base.py +0 -0
  35. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
  36. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
  37. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
  38. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
  39. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
  40. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
  41. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
  42. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/gui_automation/ui_state_machine/models.py +0 -0
  43. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/__init__.py +0 -0
  44. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/document.py +0 -0
  45. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/document_statuses.py +0 -0
  46. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/file.py +0 -0
  47. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/remote_device.py +0 -0
  48. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/response_model.py +0 -0
  49. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/models/ui_operator.py +0 -0
  50. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/utils/__init__.py +0 -0
  51. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/utils/logger.py +0 -0
  52. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk/utils/save_artifact.py +0 -0
  53. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk_sdk.egg-info/SOURCES.txt +0 -0
  54. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk_sdk.egg-info/dependency_links.txt +0 -0
  55. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk_sdk.egg-info/requires.txt +0 -0
  56. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/clerk_sdk.egg-info/top_level.txt +0 -0
  57. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/pyproject.toml +0 -0
  58. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/requirements.txt +0 -0
  59. {clerk_sdk-0.2.6 → clerk_sdk-0.2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clerk-sdk
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Library for interacting with Clerk
5
5
  Home-page: https://github.com/F-ONE-Group/clerk_pypi
6
6
  Author: F-ONE Group
@@ -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.
@@ -66,9 +66,6 @@ class ScreenPilot:
66
66
  tolerate_repeat_transitions: int = 5
67
67
  tolerate_repeat_states: int = 5
68
68
  enable_force_close_app_process: bool = False
69
- ui_operator_enabled: bool = False
70
- ui_operator_pooling_interval: int = 1 # seconds
71
- ui_operator_timeout: int = 3600 # seconds (1 hour)
72
69
  process_name: Optional[str] = None
73
70
  _acted_since_state_eval: bool = False
74
71
  _ai_recovery_agent: Optional[CourseCorrector] = None
@@ -722,14 +719,6 @@ class ScreenPilot:
722
719
  """
723
720
  return None
724
721
 
725
- @classmethod
726
- def _initialize_env_variables(cls):
727
- os.environ["_ui_operator_enabled"] = str(cls.ui_operator_enabled)
728
- os.environ["_ui_operator_pooling_interval"] = str(
729
- cls.ui_operator_pooling_interval
730
- )
731
- os.environ["_ui_operator_timeout"] = str(cls.ui_operator_timeout)
732
-
733
722
  @classmethod
734
723
  def run(
735
724
  cls, goal_function: Optional[Callable] = None, **kwargs
@@ -746,8 +735,6 @@ class ScreenPilot:
746
735
  Returns:
747
736
  - Exit reason (ScreenPilotOutcome): Exception class that interrupted the state machine execution.
748
737
  """
749
- cls._initialize_env_variables()
750
-
751
738
  if not goal_function:
752
739
  goal_function = cls._default_goal_function
753
740
  cls._act_on_start()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clerk-sdk
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Library for interacting with Clerk
5
5
  Home-page: https://github.com/F-ONE-Group/clerk_pypi
6
6
  Author: F-ONE Group
@@ -13,7 +13,7 @@ gui_requirements = get_requirements("./clerk/gui_automation")
13
13
 
14
14
  setup(
15
15
  name="clerk-sdk",
16
- version="0.2.6",
16
+ version="0.2.8",
17
17
  description="Library for interacting with Clerk",
18
18
  long_description=open("README.md").read(),
19
19
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes