docling-core 2.34.1__py3-none-any.whl → 2.34.2__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 docling-core might be problematic. Click here for more details.

@@ -1874,12 +1874,19 @@ class DoclingDocument(BaseModel):
1874
1874
 
1875
1875
  return item.get_ref()
1876
1876
 
1877
- def _delete_items(self, refs: list[RefItem]) -> bool:
1877
+ def _delete_items(self, refs: list[RefItem]):
1878
1878
  """Delete document item using the self-reference."""
1879
1879
  to_be_deleted_items: dict[tuple[int, ...], str] = {} # stack to cref
1880
1880
 
1881
+ if not refs:
1882
+ return
1883
+
1881
1884
  # Identify the to_be_deleted_items
1882
- for item, stack in self._iterate_items_with_stack(with_groups=True):
1885
+ for item, stack in self._iterate_items_with_stack(
1886
+ with_groups=True,
1887
+ traverse_pictures=True,
1888
+ included_content_layers={c for c in ContentLayer},
1889
+ ):
1883
1890
  ref = item.get_ref()
1884
1891
 
1885
1892
  if ref in refs:
@@ -1890,8 +1897,10 @@ class DoclingDocument(BaseModel):
1890
1897
  if tuple(substack) in to_be_deleted_items:
1891
1898
  to_be_deleted_items[tuple(stack)] = ref.cref
1892
1899
 
1893
- if len(to_be_deleted_items) == 0:
1894
- raise ValueError("Nothing to be deleted ...")
1900
+ if len(to_be_deleted_items) < len(refs):
1901
+ raise ValueError(
1902
+ f"Cannot find all provided RefItems in doc: {[r.cref for r in refs]}"
1903
+ )
1895
1904
 
1896
1905
  # Clean the tree, reverse the order to not have to update
1897
1906
  for stack_, ref_ in reversed(sorted(to_be_deleted_items.items())):
@@ -1931,8 +1940,6 @@ class DoclingDocument(BaseModel):
1931
1940
  node=self.body, refs_to_be_deleted=refs, lookup=lookup
1932
1941
  )
1933
1942
 
1934
- return True
1935
-
1936
1943
  # Update the references
1937
1944
  def _update_ref_with_lookup(
1938
1945
  self, item_label: str, item_index: int, lookup: dict[str, dict[int, int]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docling-core
3
- Version: 2.34.1
3
+ Version: 2.34.2
4
4
  Summary: A python library to define and validate data types in Docling.
5
5
  Author-email: Cesar Berrospi Ramis <ceb@zurich.ibm.com>, Panos Vagenas <pva@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Christoph Auer <cau@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>
6
6
  Maintainer-email: Panos Vagenas <pva@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Christoph Auer <cau@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>, Cesar Berrospi Ramis <ceb@zurich.ibm.com>
@@ -40,7 +40,7 @@ docling_core/types/__init__.py,sha256=MVRSgsk5focwGyAplh_TRR3dEecIXpd98g_u3zZ5HX
40
40
  docling_core/types/base.py,sha256=PusJskRVL19y-hq0BgXr5e8--QEqSqLnFNJ8UbOqW88,8318
41
41
  docling_core/types/doc/__init__.py,sha256=bysJn2iwjAHwThSWDPXEdVUUij7p_ax12_nx2_0CMdg,653
42
42
  docling_core/types/doc/base.py,sha256=ndXquBrOKTFQApIJ5s2-zstj3xlVKRbJDSId0KOQnUg,14817
43
- docling_core/types/doc/document.py,sha256=hQ4eXNjqbAQ2Tklr2RM7Xy0vZLwdoTymSQuJGskSOEw,148336
43
+ docling_core/types/doc/document.py,sha256=UMQ7eSfXM0l2QPBpc4fg67OlYaWEJsgWqke_fk9jCUw,148549
44
44
  docling_core/types/doc/labels.py,sha256=vp4h3e7AmBvezRmgrfuPehjAHTZOufphErLB4ENhdME,7171
45
45
  docling_core/types/doc/page.py,sha256=1JMPwglaTITBvg959L_pcWPb-fXoDYGh-e_tGZMzVMQ,41060
46
46
  docling_core/types/doc/tokens.py,sha256=z22l9J81_sg9CYMvOuLmPuLsNT7h_s7wao2UT89DvI8,9278
@@ -73,9 +73,9 @@ docling_core/utils/generate_jsonschema.py,sha256=uNX1O5XnjyB5nA66XqZXTt3YbGuR2ty
73
73
  docling_core/utils/legacy.py,sha256=DrI3QGoL755ZCIoKHF74-pTWm8R0zfFo2C2vB5dT2aY,24463
74
74
  docling_core/utils/validate.py,sha256=aQ11UbFyl8iD_N7yTTZmm_VVeXz8KcCyn3GLXgkfYRM,2049
75
75
  docling_core/utils/validators.py,sha256=azcrndLzhNkTWnbFSu9shJ5D3j_znnLrIFA5R8hzmGU,2798
76
- docling_core-2.34.1.dist-info/licenses/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
77
- docling_core-2.34.1.dist-info/METADATA,sha256=CnJF6fq7wPKEcfPhihxBZP0QFYf1Y5TkVKCHflpKKw0,6453
78
- docling_core-2.34.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
- docling_core-2.34.1.dist-info/entry_points.txt,sha256=ER4zROQWkFMHIrY-oqY5E4HeCcCIg8dLkNztYGxdb7c,59
80
- docling_core-2.34.1.dist-info/top_level.txt,sha256=O-tcXpGiurlud-1ZxMq1b-OmrfAVA4sajcgWU32RtfA,13
81
- docling_core-2.34.1.dist-info/RECORD,,
76
+ docling_core-2.34.2.dist-info/licenses/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
77
+ docling_core-2.34.2.dist-info/METADATA,sha256=SZQWH-WCvFQCz39nJqxUjv_t14TaI_WDThYzOki7EHc,6453
78
+ docling_core-2.34.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
+ docling_core-2.34.2.dist-info/entry_points.txt,sha256=ER4zROQWkFMHIrY-oqY5E4HeCcCIg8dLkNztYGxdb7c,59
80
+ docling_core-2.34.2.dist-info/top_level.txt,sha256=O-tcXpGiurlud-1ZxMq1b-OmrfAVA4sajcgWU32RtfA,13
81
+ docling_core-2.34.2.dist-info/RECORD,,