datamint 1.9.0__tar.gz → 1.9.1__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.

Potentially problematic release.


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

Files changed (27) hide show
  1. {datamint-1.9.0 → datamint-1.9.1}/PKG-INFO +1 -1
  2. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/root_api_handler.py +54 -11
  3. {datamint-1.9.0 → datamint-1.9.1}/pyproject.toml +1 -1
  4. {datamint-1.9.0 → datamint-1.9.1}/README.md +0 -0
  5. {datamint-1.9.0 → datamint-1.9.1}/datamint/__init__.py +0 -0
  6. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/annotation_api_handler.py +0 -0
  7. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/api_handler.py +0 -0
  8. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/base_api_handler.py +0 -0
  9. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/dto/annotation_dto.py +0 -0
  10. {datamint-1.9.0 → datamint-1.9.1}/datamint/apihandler/exp_api_handler.py +0 -0
  11. {datamint-1.9.0 → datamint-1.9.1}/datamint/client_cmd_tools/__init__.py +0 -0
  12. {datamint-1.9.0 → datamint-1.9.1}/datamint/client_cmd_tools/datamint_config.py +0 -0
  13. {datamint-1.9.0 → datamint-1.9.1}/datamint/client_cmd_tools/datamint_upload.py +0 -0
  14. {datamint-1.9.0 → datamint-1.9.1}/datamint/configs.py +0 -0
  15. {datamint-1.9.0 → datamint-1.9.1}/datamint/dataset/__init__.py +0 -0
  16. {datamint-1.9.0 → datamint-1.9.1}/datamint/dataset/annotation.py +0 -0
  17. {datamint-1.9.0 → datamint-1.9.1}/datamint/dataset/base_dataset.py +0 -0
  18. {datamint-1.9.0 → datamint-1.9.1}/datamint/dataset/dataset.py +0 -0
  19. {datamint-1.9.0 → datamint-1.9.1}/datamint/examples/__init__.py +0 -0
  20. {datamint-1.9.0 → datamint-1.9.1}/datamint/examples/example_projects.py +0 -0
  21. {datamint-1.9.0 → datamint-1.9.1}/datamint/experiment/__init__.py +0 -0
  22. {datamint-1.9.0 → datamint-1.9.1}/datamint/experiment/_patcher.py +0 -0
  23. {datamint-1.9.0 → datamint-1.9.1}/datamint/experiment/experiment.py +0 -0
  24. {datamint-1.9.0 → datamint-1.9.1}/datamint/logging.yaml +0 -0
  25. {datamint-1.9.0 → datamint-1.9.1}/datamint/utils/logging_utils.py +0 -0
  26. {datamint-1.9.0 → datamint-1.9.1}/datamint/utils/torchmetrics.py +0 -0
  27. {datamint-1.9.0 → datamint-1.9.1}/datamint/utils/visualization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamint
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows.
5
5
  Requires-Python: >=3.10
6
6
  Classifier: Programming Language :: Python :: 3
@@ -429,8 +429,21 @@ class RootAPIHandler(BaseAPIHandler):
429
429
 
430
430
  # Discard DICOM reports
431
431
  if discard_dicom_reports:
432
- files_path = [f for f in files_path if not is_dicom_report(f)]
433
432
  old_size = len(files_path)
433
+ # Create filtered lists maintaining index correspondence
434
+ filtered_files = []
435
+ filtered_metadata = []
436
+
437
+ for i, f in enumerate(files_path):
438
+ if not is_dicom_report(f):
439
+ filtered_files.append(f)
440
+ if metadata is not None:
441
+ filtered_metadata.append(metadata[i])
442
+
443
+ files_path = filtered_files
444
+ if metadata is not None:
445
+ metadata = filtered_metadata
446
+
434
447
  if old_size is not None and old_size != len(files_path):
435
448
  _LOGGER.info(f"Discarded {old_size - len(files_path)} DICOM report files from upload.")
436
449
 
@@ -1099,16 +1112,46 @@ class RootAPIHandler(BaseAPIHandler):
1099
1112
  """
1100
1113
  if isinstance(resource_ids, str):
1101
1114
  resource_ids = [resource_ids]
1102
- for rid in resource_ids:
1103
- url = f"{self._get_endpoint_url(RootAPIHandler.ENDPOINT_RESOURCES)}/{rid}"
1104
- request_params = {'method': 'DELETE',
1105
- 'url': url
1106
- }
1107
- try:
1108
- self._run_request(request_params)
1109
- except ResourceNotFoundError as e:
1110
- e.set_params('resource', {'resource_id': rid})
1111
- raise e
1115
+
1116
+ async def _delete_all_resources_async():
1117
+ async with aiohttp.ClientSession() as session:
1118
+ tasks = [
1119
+ self._delete_resource_async(resource_id, session)
1120
+ for resource_id in resource_ids
1121
+ ]
1122
+ await asyncio.gather(*tasks)
1123
+
1124
+ loop = asyncio.get_event_loop()
1125
+ loop.run_until_complete(_delete_all_resources_async())
1126
+
1127
+
1128
+ async def _delete_resource_async(self,
1129
+ resource_id: str,
1130
+ session: aiohttp.ClientSession | None = None) -> None:
1131
+ """
1132
+ Asynchronously delete a resource by its unique id.
1133
+
1134
+ Args:
1135
+ resource_id (str): The resource unique id.
1136
+ session (aiohttp.ClientSession | None): The aiohttp session to use for the request.
1137
+
1138
+ Raises:
1139
+ ResourceNotFoundError: If the resource does not exist.
1140
+ """
1141
+ if session is not None and not isinstance(session, aiohttp.ClientSession):
1142
+ raise ValueError("session must be an aiohttp.ClientSession object.")
1143
+
1144
+ url = f"{self._get_endpoint_url(RootAPIHandler.ENDPOINT_RESOURCES)}/{resource_id}"
1145
+ request_params = {
1146
+ 'method': 'DELETE',
1147
+ 'url': url
1148
+ }
1149
+
1150
+ try:
1151
+ await self._run_request_async(request_params, session)
1152
+ except ResourceNotFoundError as e:
1153
+ e.set_params('resource', {'resource_id': resource_id})
1154
+ raise e
1112
1155
 
1113
1156
  def get_datasets(self) -> list[dict]:
1114
1157
  """
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "datamint"
3
3
  description = "A library for interacting with the Datamint API, designed for efficient data management, processing and Deep Learning workflows."
4
- version = "1.9.0"
4
+ version = "1.9.1"
5
5
  dynamic = ["dependencies"]
6
6
  requires-python = ">=3.10"
7
7
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes