clerk-sdk 0.3.2__tar.gz → 0.3.4__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 (63) hide show
  1. {clerk_sdk-0.3.2/clerk_sdk.egg-info → clerk_sdk-0.3.4}/PKG-INFO +1 -1
  2. clerk_sdk-0.3.4/clerk/decorator/task_decorator.py +92 -0
  3. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4/clerk_sdk.egg-info}/PKG-INFO +1 -1
  4. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/setup.py +1 -1
  5. clerk_sdk-0.3.2/clerk/decorator/task_decorator.py +0 -68
  6. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/LICENSE +0 -0
  7. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/MANIFEST.in +0 -0
  8. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/README.md +0 -0
  9. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/__init__.py +0 -0
  10. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/base.py +0 -0
  11. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/client.py +0 -0
  12. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/decorator/__init__.py +0 -0
  13. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/decorator/models.py +0 -0
  14. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/exceptions/__init__.py +0 -0
  15. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/exceptions/exceptions.py +0 -0
  16. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/exceptions/remote_device.py +0 -0
  17. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/__init__.py +0 -0
  18. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/action_model/__init__.py +0 -0
  19. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/action_model/model.py +0 -0
  20. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/action_model/utils.py +0 -0
  21. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/client.py +0 -0
  22. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/client_actor/__init__.py +0 -0
  23. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/client_actor/client_actor.py +0 -0
  24. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/client_actor/exception.py +0 -0
  25. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/client_actor/model.py +0 -0
  26. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/decorators/__init__.py +0 -0
  27. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/decorators/gui_automation.py +0 -0
  28. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/exceptions/__init__.py +0 -0
  29. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
  30. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
  31. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
  32. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/exceptions/websocket.py +0 -0
  33. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/requirements.txt +0 -0
  34. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_actions/__init__.py +0 -0
  35. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_actions/actions.py +0 -0
  36. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_actions/base.py +0 -0
  37. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_actions/support.py +0 -0
  38. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
  39. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
  40. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
  41. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
  42. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
  43. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
  44. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
  45. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/models.py +0 -0
  46. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -0
  47. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/__init__.py +0 -0
  48. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/document.py +0 -0
  49. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/document_statuses.py +0 -0
  50. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/file.py +0 -0
  51. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/remote_device.py +0 -0
  52. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/response_model.py +0 -0
  53. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/models/ui_operator.py +0 -0
  54. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/utils/__init__.py +0 -0
  55. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/utils/logger.py +0 -0
  56. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk/utils/save_artifact.py +0 -0
  57. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk_sdk.egg-info/SOURCES.txt +0 -0
  58. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk_sdk.egg-info/dependency_links.txt +0 -0
  59. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk_sdk.egg-info/requires.txt +0 -0
  60. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/clerk_sdk.egg-info/top_level.txt +0 -0
  61. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/pyproject.toml +0 -0
  62. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/requirements.txt +0 -0
  63. {clerk_sdk-0.3.2 → clerk_sdk-0.3.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clerk-sdk
3
- Version: 0.3.2
3
+ Version: 0.3.4
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
@@ -0,0 +1,92 @@
1
+ import pickle
2
+ import traceback
3
+ from typing import Callable, Optional
4
+ from functools import wraps
5
+
6
+ from clerk.exceptions.exceptions import ApplicationException
7
+ from .models import ClerkCodePayload
8
+
9
+ input_pkl: str = "/app/data/input/input.pkl"
10
+ output_pkl: str = "/app/data/output/output.pkl"
11
+
12
+
13
+ def clerk_code():
14
+ def decorator(func: Callable[[ClerkCodePayload], ClerkCodePayload]):
15
+ @wraps(func)
16
+ def wrapper(payload: Optional[ClerkCodePayload] = None) -> ClerkCodePayload:
17
+ # 1. Load payload from file if not provided
18
+ use_pickle = False
19
+ output = None
20
+ error_occurred = False
21
+ error_info = None
22
+ if payload is None:
23
+ use_pickle = True
24
+ # Write a placeholder output file in case of early failure
25
+ with open(output_pkl, "wb") as f:
26
+ pickle.dump({"error": "Early failure"}, f)
27
+ try:
28
+ with open(input_pkl, "rb") as f:
29
+ raw_data = pickle.load(f)
30
+ payload = (
31
+ ClerkCodePayload.model_validate(raw_data)
32
+ if not isinstance(raw_data, ClerkCodePayload)
33
+ else raw_data
34
+ )
35
+ except Exception as e:
36
+ error_occurred = True
37
+ error_info = ApplicationException(
38
+ type_=str(type(e)),
39
+ message=f"Failed to load and parse input pickle: {e}",
40
+ traceback=traceback.format_exc(),
41
+ )
42
+
43
+ # 2. Execute function
44
+ if not error_occurred:
45
+ try:
46
+ output = func(payload)
47
+ if not isinstance(output, ClerkCodePayload):
48
+ raise TypeError(
49
+ "Function must return a ClerkCodePayload instance."
50
+ )
51
+ except Exception as e:
52
+ error_occurred = True
53
+ error_info = ApplicationException(
54
+ type_=str(type(e)),
55
+ message=str(e),
56
+ traceback=traceback.format_exc(),
57
+ )
58
+
59
+ # 3. write to output.pkl
60
+ try:
61
+ if use_pickle:
62
+ with open(output_pkl, "wb") as f:
63
+ if error_occurred:
64
+ pickle.dump(error_info, f)
65
+ elif isinstance(output, Exception):
66
+ pickle.dump(output, f)
67
+ else:
68
+ pickle.dump(output.model_dump(mode="json"), f)
69
+ except Exception as e:
70
+ # If writing output.pkl fails, try to write a minimal error
71
+ try:
72
+ with open(output_pkl, "wb") as f:
73
+ pickle.dump(
74
+ ApplicationException(
75
+ type_=str(type(e)),
76
+ message=f"Failed to write output pickle: {str(e)}",
77
+ traceback=traceback.format_exc(),
78
+ ),
79
+ f,
80
+ )
81
+ except Exception:
82
+ pass # Last resort: do nothing if even this fails
83
+
84
+ # 4. Raise if error or return result
85
+ if isinstance(output, Exception):
86
+ raise output
87
+
88
+ return output
89
+
90
+ return wrapper
91
+
92
+ return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clerk-sdk
3
- Version: 0.3.2
3
+ Version: 0.3.4
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.3.2",
16
+ version="0.3.4",
17
17
  description="Library for interacting with Clerk",
18
18
  long_description=open("README.md").read(),
19
19
  long_description_content_type="text/markdown",
@@ -1,68 +0,0 @@
1
- import os
2
- import pickle
3
- import traceback
4
- from typing import Callable, Optional
5
- from functools import wraps
6
-
7
- from clerk.exceptions.exceptions import ApplicationException
8
- from .models import ClerkCodePayload
9
-
10
- input_pkl: str = "/app/data/input/input.pkl"
11
- output_pkl: str = "/app/data/output/output.pkl"
12
-
13
-
14
- def clerk_code():
15
- def decorator(func: Callable[[ClerkCodePayload], ClerkCodePayload]):
16
- @wraps(func)
17
- def wrapper(payload: Optional[ClerkCodePayload] = None) -> ClerkCodePayload:
18
- # 1. Load payload from file if not provided
19
- use_pickle = False
20
- if payload is None:
21
- use_pickle = True
22
- try:
23
- with open(input_pkl, "rb") as f:
24
- raw_data = pickle.load(f)
25
- payload = (
26
- ClerkCodePayload.model_validate(raw_data)
27
- if not isinstance(raw_data, ClerkCodePayload)
28
- else raw_data
29
- )
30
- except Exception as e:
31
- raise RuntimeError(
32
- f"Failed to load and parse input pickle: {e}"
33
- ) from e
34
-
35
- # 2. Execute function
36
- try:
37
- output = func(payload)
38
- if not isinstance(output, ClerkCodePayload):
39
- raise TypeError("Function must return a ClerkCodePayload instance.")
40
- except Exception as e:
41
- # parse no standard errors into the standard Application Error
42
- output = ApplicationException(
43
- type_=str(type(e)), message=str(e), traceback=traceback.format_exc()
44
- )
45
-
46
- # 3. write to output.pkl
47
- try:
48
- if use_pickle:
49
- with open(output_pkl, "wb") as f:
50
- if isinstance(output, Exception):
51
- pickle.dump(output, f)
52
- else:
53
- pickle.dump(output.model_dump(mode="json"), f)
54
-
55
- except Exception as e:
56
- output = RuntimeError(f"Failed to write output pickle: {str(e)}")
57
- with open(output_pkl, "wb") as f:
58
- pickle.dump(output, f)
59
-
60
- # 4. Raise if error or return result
61
- if isinstance(output, Exception):
62
- raise output
63
-
64
- return output
65
-
66
- return wrapper
67
-
68
- return decorator
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