containerio 2.2.0__tar.gz → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: containerio
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: Azure Blob Storage handler with unified local/cloud interface
5
5
  Author: Alliance SwissPass
6
6
  Requires-Dist: polars>=1.30.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "containerio"
3
- version = "2.2.0"
3
+ version = "2.2.1"
4
4
  description = "Azure Blob Storage handler with unified local/cloud interface"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1049,18 +1049,22 @@ class StorageHandler:
1049
1049
  prefix = blob_name.rstrip("/") + "/"
1050
1050
  children = list(self.container_client.list_blobs(name_starts_with=prefix))
1051
1051
 
1052
- # Try exact blob match
1052
+ # Delete children deepest-first. On hierarchical-namespace
1053
+ # (ADLS Gen2) accounts a directory placeholder cannot be
1054
+ # removed until empty, and a parent path always sorts before
1055
+ # its descendants, so reverse order empties each placeholder
1056
+ # before deleting it. Flat namespaces are order-independent.
1057
+ for blob in sorted(children, key=lambda child: child.name, reverse=True):
1058
+ self._get_blob_client(blob_name=blob.name).delete_blob()
1059
+ deleted.append(blob.name)
1060
+
1061
+ # Delete the exact blob (file or now-empty dir) last.
1053
1062
  try:
1054
1063
  self._get_blob_client(blob_name=blob_name).delete_blob()
1055
1064
  deleted.append(blob_name)
1056
1065
  except ResourceNotFoundError:
1057
1066
  pass
1058
1067
 
1059
- # Delete all blobs under the prefix
1060
- for blob in children:
1061
- self._get_blob_client(blob_name=blob.name).delete_blob()
1062
- deleted.append(blob.name)
1063
-
1064
1068
  if not deleted:
1065
1069
  raise FileNotFoundError(f"Blob not found: {blob_name}")
1066
1070
 
File without changes