clerk-sdk 0.3.2__tar.gz → 0.3.3__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.3}/PKG-INFO +1 -1
  2. clerk_sdk-0.3.3/clerk/decorator/task_decorator.py +89 -0
  3. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3/clerk_sdk.egg-info}/PKG-INFO +1 -1
  4. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/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.3}/LICENSE +0 -0
  7. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/MANIFEST.in +0 -0
  8. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/README.md +0 -0
  9. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/__init__.py +0 -0
  10. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/base.py +0 -0
  11. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/client.py +0 -0
  12. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/decorator/__init__.py +0 -0
  13. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/decorator/models.py +0 -0
  14. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/exceptions/__init__.py +0 -0
  15. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/exceptions/exceptions.py +0 -0
  16. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/exceptions/remote_device.py +0 -0
  17. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/__init__.py +0 -0
  18. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/action_model/__init__.py +0 -0
  19. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/action_model/model.py +0 -0
  20. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/action_model/utils.py +0 -0
  21. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/client.py +0 -0
  22. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/client_actor/__init__.py +0 -0
  23. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/client_actor/client_actor.py +0 -0
  24. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/client_actor/exception.py +0 -0
  25. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/client_actor/model.py +0 -0
  26. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/decorators/__init__.py +0 -0
  27. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/decorators/gui_automation.py +0 -0
  28. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/exceptions/__init__.py +0 -0
  29. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/exceptions/agent_manager.py +0 -0
  30. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/exceptions/modality/__init__.py +0 -0
  31. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/exceptions/modality/exc.py +0 -0
  32. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/exceptions/websocket.py +0 -0
  33. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/requirements.txt +0 -0
  34. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_actions/__init__.py +0 -0
  35. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_actions/actions.py +0 -0
  36. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_actions/base.py +0 -0
  37. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_actions/support.py +0 -0
  38. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_inspector/__init__.py +0 -0
  39. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_inspector/gui_vision.py +0 -0
  40. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_inspector/models.py +0 -0
  41. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/__init__.py +0 -0
  42. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/ai_recovery.py +0 -0
  43. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/decorators.py +0 -0
  44. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/exceptions.py +0 -0
  45. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/models.py +0 -0
  46. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/gui_automation/ui_state_machine/state_machine.py +0 -0
  47. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/__init__.py +0 -0
  48. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/document.py +0 -0
  49. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/document_statuses.py +0 -0
  50. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/file.py +0 -0
  51. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/remote_device.py +0 -0
  52. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/response_model.py +0 -0
  53. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/models/ui_operator.py +0 -0
  54. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/utils/__init__.py +0 -0
  55. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/utils/logger.py +0 -0
  56. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk/utils/save_artifact.py +0 -0
  57. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk_sdk.egg-info/SOURCES.txt +0 -0
  58. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk_sdk.egg-info/dependency_links.txt +0 -0
  59. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk_sdk.egg-info/requires.txt +0 -0
  60. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/clerk_sdk.egg-info/top_level.txt +0 -0
  61. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/pyproject.toml +0 -0
  62. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/requirements.txt +0 -0
  63. {clerk_sdk-0.3.2 → clerk_sdk-0.3.3}/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.3
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,89 @@
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
+ try:
25
+ with open(input_pkl, "rb") as f:
26
+ raw_data = pickle.load(f)
27
+ payload = (
28
+ ClerkCodePayload.model_validate(raw_data)
29
+ if not isinstance(raw_data, ClerkCodePayload)
30
+ else raw_data
31
+ )
32
+ except Exception as e:
33
+ error_occurred = True
34
+ error_info = ApplicationException(
35
+ type_=str(type(e)),
36
+ message=f"Failed to load and parse input pickle: {e}",
37
+ traceback=traceback.format_exc(),
38
+ )
39
+
40
+ # 2. Execute function
41
+ if not error_occurred:
42
+ try:
43
+ output = func(payload)
44
+ if not isinstance(output, ClerkCodePayload):
45
+ raise TypeError(
46
+ "Function must return a ClerkCodePayload instance."
47
+ )
48
+ except Exception as e:
49
+ error_occurred = True
50
+ error_info = ApplicationException(
51
+ type_=str(type(e)),
52
+ message=str(e),
53
+ traceback=traceback.format_exc(),
54
+ )
55
+
56
+ # 3. write to output.pkl
57
+ try:
58
+ if use_pickle:
59
+ with open(output_pkl, "wb") as f:
60
+ if error_occurred:
61
+ pickle.dump(error_info, f)
62
+ elif isinstance(output, Exception):
63
+ pickle.dump(output, f)
64
+ else:
65
+ pickle.dump(output.model_dump(mode="json"), f)
66
+ except Exception as e:
67
+ # If writing output.pkl fails, try to write a minimal error
68
+ try:
69
+ with open(output_pkl, "wb") as f:
70
+ pickle.dump(
71
+ ApplicationException(
72
+ type_=str(type(e)),
73
+ message=f"Failed to write output pickle: {str(e)}",
74
+ traceback=traceback.format_exc(),
75
+ ),
76
+ f,
77
+ )
78
+ except Exception:
79
+ pass # Last resort: do nothing if even this fails
80
+
81
+ # 4. Raise if error or return result
82
+ if isinstance(output, Exception):
83
+ raise output
84
+
85
+ return output
86
+
87
+ return wrapper
88
+
89
+ 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.3
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.3",
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