sapiopycommons 2025.9.19a761__py3-none-any.whl → 2025.10.1a772__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.

Potentially problematic release.


This version of sapiopycommons might be problematic. Click here for more details.

Files changed (41) hide show
  1. sapiopycommons/webhook/webservice_handlers.py +1 -1
  2. {sapiopycommons-2025.9.19a761.dist-info → sapiopycommons-2025.10.1a772.dist-info}/METADATA +1 -1
  3. {sapiopycommons-2025.9.19a761.dist-info → sapiopycommons-2025.10.1a772.dist-info}/RECORD +5 -41
  4. sapiopycommons/ai/converter_service_base.py +0 -163
  5. sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.py +0 -43
  6. sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2.pyi +0 -31
  7. sapiopycommons/ai/protoapi/fielddefinitions/fields_pb2_grpc.py +0 -24
  8. sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.py +0 -123
  9. sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2.pyi +0 -598
  10. sapiopycommons/ai/protoapi/fielddefinitions/velox_field_def_pb2_grpc.py +0 -24
  11. sapiopycommons/ai/protoapi/plan/converter/converter_pb2.py +0 -51
  12. sapiopycommons/ai/protoapi/plan/converter/converter_pb2.pyi +0 -63
  13. sapiopycommons/ai/protoapi/plan/converter/converter_pb2_grpc.py +0 -149
  14. sapiopycommons/ai/protoapi/plan/item/item_container_pb2.py +0 -55
  15. sapiopycommons/ai/protoapi/plan/item/item_container_pb2.pyi +0 -90
  16. sapiopycommons/ai/protoapi/plan/item/item_container_pb2_grpc.py +0 -24
  17. sapiopycommons/ai/protoapi/plan/script/script_pb2.py +0 -59
  18. sapiopycommons/ai/protoapi/plan/script/script_pb2.pyi +0 -102
  19. sapiopycommons/ai/protoapi/plan/script/script_pb2_grpc.py +0 -153
  20. sapiopycommons/ai/protoapi/plan/step_output_pb2.py +0 -45
  21. sapiopycommons/ai/protoapi/plan/step_output_pb2.pyi +0 -42
  22. sapiopycommons/ai/protoapi/plan/step_output_pb2_grpc.py +0 -24
  23. sapiopycommons/ai/protoapi/plan/step_pb2.py +0 -43
  24. sapiopycommons/ai/protoapi/plan/step_pb2.pyi +0 -43
  25. sapiopycommons/ai/protoapi/plan/step_pb2_grpc.py +0 -24
  26. sapiopycommons/ai/protoapi/plan/tool/entry_pb2.py +0 -41
  27. sapiopycommons/ai/protoapi/plan/tool/entry_pb2.pyi +0 -35
  28. sapiopycommons/ai/protoapi/plan/tool/entry_pb2_grpc.py +0 -24
  29. sapiopycommons/ai/protoapi/plan/tool/tool_pb2.py +0 -77
  30. sapiopycommons/ai/protoapi/plan/tool/tool_pb2.pyi +0 -253
  31. sapiopycommons/ai/protoapi/plan/tool/tool_pb2_grpc.py +0 -154
  32. sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.py +0 -39
  33. sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2.pyi +0 -32
  34. sapiopycommons/ai/protoapi/session/sapio_conn_info_pb2_grpc.py +0 -24
  35. sapiopycommons/ai/protobuf_utils.py +0 -504
  36. sapiopycommons/ai/server.py +0 -145
  37. sapiopycommons/ai/test_client.py +0 -367
  38. sapiopycommons/ai/tool_service_base.py +0 -1099
  39. sapiopycommons/files/temp_files.py +0 -79
  40. {sapiopycommons-2025.9.19a761.dist-info → sapiopycommons-2025.10.1a772.dist-info}/WHEEL +0 -0
  41. {sapiopycommons-2025.9.19a761.dist-info → sapiopycommons-2025.10.1a772.dist-info}/licenses/LICENSE +0 -0
@@ -1,79 +0,0 @@
1
- import os
2
- import shutil
3
- import tempfile
4
- from typing import Callable
5
-
6
-
7
- # FR-47422: Created class.
8
- class TempFileHandler:
9
- """
10
- A utility class to manage temporary files and directories.
11
- """
12
- directories: list[str]
13
- files: list[str]
14
-
15
- def __init__(self) -> None:
16
- self.directories = []
17
- self.files = []
18
-
19
- def create_temp_directory(self) -> str:
20
- """
21
- Create a temporary directory.
22
-
23
- :return: The path to a newly created temporary directory.
24
- """
25
- directory: str = tempfile.mkdtemp()
26
- self.directories.append(directory)
27
- return directory
28
-
29
- def create_temp_file(self, data: str | bytes, suffix: str = "") -> str:
30
- """
31
- Create a temporary file with the specified data and optional suffix.
32
-
33
- :param data: The data to write to the temporary file.
34
- :param suffix: An optional suffix for the temporary file.
35
- :return: The path to a newly created temporary file containing the provided data.
36
- """
37
- mode: str = 'w' if isinstance(data, str) else 'wb'
38
- with tempfile.NamedTemporaryFile(mode=mode, suffix=suffix, delete=False) as tmp_file:
39
- tmp_file.write(data)
40
- file_path: str = tmp_file.name
41
- self.files.append(file_path)
42
- return file_path
43
-
44
- def create_temp_file_from_func(self, func: Callable, is_binary: bool = True, suffix: str = "", **kwargs) -> str:
45
- """
46
- Create a temporary file and populate it using the provided function. The function should accept parameters as
47
- specified in the `params` dictionary. Any parameter in `params` with the value "<NEW_FILE>" will be replaced
48
- with the path of the created temporary file.
49
-
50
- :param func: The function to call with the temporary file path that will populate the file.
51
- :param is_binary: Whether to open the temporary file in binary mode.
52
- :param suffix: An optional suffix for the temporary file.
53
- :param kwargs: Keyword arguments to pass to the function. Use "<NEW_FILE>" as a value to indicate where the
54
- temporary file path should be inserted.
55
- :return: The path to the newly created temporary file.
56
- """
57
- mode: str = 'wb' if is_binary else 'w'
58
- with tempfile.NamedTemporaryFile(mode, suffix=suffix, delete=False) as tmp_file:
59
- file_path: str = tmp_file.name
60
- for key, value in kwargs.items():
61
- if value == "<NEW_FILE>":
62
- kwargs[key] = file_path
63
- func(**kwargs)
64
- self.files.append(file_path)
65
- return file_path
66
-
67
- def cleanup(self) -> None:
68
- """
69
- Delete all temporary files and directories created by this handler.
70
- """
71
- for directory in self.directories:
72
- if os.path.exists(directory):
73
- shutil.rmtree(directory)
74
- self.directories.clear()
75
-
76
- for file_path in self.files:
77
- if os.path.exists(file_path):
78
- os.remove(file_path)
79
- self.files.clear()