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

@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import shutil
3
3
  import tempfile
4
- from typing import Callable
4
+ from typing import Callable, Any
5
5
 
6
6
 
7
7
  # FR-47422: Created class.
@@ -41,26 +41,29 @@ class TempFileHandler:
41
41
  self.files.append(file_path)
42
42
  return file_path
43
43
 
44
- def create_temp_file_from_func(self, func: Callable, is_binary: bool = True, suffix: str = "", **kwargs) -> str:
44
+ def create_temp_file_from_func(self, func: Callable, params: dict[str, Any], suffix: str = "",
45
+ is_binary: bool = True) -> str:
45
46
  """
46
47
  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.
48
+ specified in the `params` dictionary.
49
49
 
50
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.
51
+ :param params: Keyword arguments to pass to the function. If "<NEW_FILE>" is used as a value, it will be
52
+ replaced with the temporary file object. If "<NEW_FILE_PATH>" is used as a value, it will be replaced with
53
+ the temporary file path.
52
54
  :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
+ :param is_binary: Whether to open the temporary file in binary mode.
55
56
  :return: The path to the newly created temporary file.
56
57
  """
57
58
  mode: str = 'wb' if is_binary else 'w'
58
59
  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():
60
+ for key, value in params.items():
61
61
  if value == "<NEW_FILE>":
62
- kwargs[key] = file_path
63
- func(**kwargs)
62
+ params[key] = tmp_file
63
+ elif value == "<NEW_FILE_PATH>":
64
+ params[key] = tmp_file.name
65
+ func(**params)
66
+ file_path: str = tmp_file.name
64
67
  self.files.append(file_path)
65
68
  return file_path
66
69
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sapiopycommons
3
- Version: 2025.9.19a761
3
+ Version: 2025.9.19a762
4
4
  Summary: Official Sapio Python API Utilities Package
5
5
  Project-URL: Homepage, https://github.com/sapiosciences
6
6
  Author-email: Jonathan Steck <jsteck@sapiosciences.com>, Yechen Qiao <yqiao@sapiosciences.com>
@@ -69,7 +69,7 @@ sapiopycommons/files/file_text_converter.py,sha256=Gaj_divTiKXWd6flDOgrxNXpcn9fD
69
69
  sapiopycommons/files/file_util.py,sha256=djouyGjsYgWzjz2OBRnSeMDgj6NrsJUm1a2J93J8Wco,31915
70
70
  sapiopycommons/files/file_validator.py,sha256=ryg22-93csmRO_Pv0ZpWphNkB74xWZnHyJ23K56qLj0,28761
71
71
  sapiopycommons/files/file_writer.py,sha256=hACVl0duCjP28gJ1NPljkjagNCLod0ygUlPbvUmRDNM,17605
72
- sapiopycommons/files/temp_files.py,sha256=e1PV07wFN5At1Ob-TbfS9nsPiZ8u9_Fl22KnWxJMmac,3056
72
+ sapiopycommons/files/temp_files.py,sha256=i-xgh4puYLtREI1ZtKq8y5q1lRWQX_UrVyJd2yQO0hw,3183
73
73
  sapiopycommons/flowcyto/flow_cyto.py,sha256=B6DFquLi-gcWfJWyP4vYfwTXXJKl6O9W5-k8FzkM0Oo,2610
74
74
  sapiopycommons/flowcyto/flowcyto_data.py,sha256=mYKFuLbtpJ-EsQxLGtu4tNHVlygTxKixgJxJqD68F58,2596
75
75
  sapiopycommons/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -102,7 +102,7 @@ sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
102
102
  sapiopycommons/webhook/webhook_context.py,sha256=D793uLsb1691SalaPnBUk3rOSxn_hYLhdvkaIxjNXss,1909
103
103
  sapiopycommons/webhook/webhook_handlers.py,sha256=7o_wXOruhT9auNh8OfhJAh4WhhiPKij67FMBSpGPICc,39939
104
104
  sapiopycommons/webhook/webservice_handlers.py,sha256=cvW6Mk_110BzYqkbk63Kg7jWrltBCDALOlkJRu8h4VQ,14300
105
- sapiopycommons-2025.9.19a761.dist-info/METADATA,sha256=As9JoZ85SMYRqYv83_ri1EKVYvMbU3dNWvkIVZ5RGA4,3142
106
- sapiopycommons-2025.9.19a761.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
107
- sapiopycommons-2025.9.19a761.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
108
- sapiopycommons-2025.9.19a761.dist-info/RECORD,,
105
+ sapiopycommons-2025.9.19a762.dist-info/METADATA,sha256=dxPZddM3xm1Snxkaz13GKRGUHWI3aY6Pw9zpepex0HM,3142
106
+ sapiopycommons-2025.9.19a762.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
107
+ sapiopycommons-2025.9.19a762.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
108
+ sapiopycommons-2025.9.19a762.dist-info/RECORD,,