mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-26 20:14:47 +00:00
fix: run poetry pre-commit all files to black format changes Signed-off-by: Franck Benichou franck.benichou@sciencespo.fr
Signed-off-by: Benichou <fbenichou@deloitte.ca>
This commit is contained in:
parent
45eb3e79f7
commit
30cfaaf39f
@ -46,10 +46,13 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
|||||||
|
|
||||||
self.pptx_obj = None
|
self.pptx_obj = None
|
||||||
self.valid = False
|
self.valid = False
|
||||||
self.xpath_expr = etree.XPath(".//a:blip", namespaces={
|
self.xpath_expr = etree.XPath(
|
||||||
|
".//a:blip",
|
||||||
|
namespaces={
|
||||||
"a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
"a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||||
"r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
"r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
||||||
})
|
},
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
if isinstance(self.path_or_stream, BytesIO):
|
if isinstance(self.path_or_stream, BytesIO):
|
||||||
self.pptx_obj = Presentation(self.path_or_stream)
|
self.pptx_obj = Presentation(self.path_or_stream)
|
||||||
@ -284,7 +287,9 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
def handle_pictures(self, shape, parent_slide, slide_ind, doc, slide_size, drawing_blip, slide):
|
def handle_pictures(
|
||||||
|
self, shape, parent_slide, slide_ind, doc, slide_size, drawing_blip, slide
|
||||||
|
):
|
||||||
|
|
||||||
def get_pptx_image(drawing_blip):
|
def get_pptx_image(drawing_blip):
|
||||||
rId = drawing_blip[0].get(
|
rId = drawing_blip[0].get(
|
||||||
@ -295,6 +300,7 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
|||||||
image_data = image_part.blob
|
image_data = image_part.blob
|
||||||
|
|
||||||
return image_data
|
return image_data
|
||||||
|
|
||||||
# Open it with PIL
|
# Open it with PIL
|
||||||
try:
|
try:
|
||||||
# Get the image bytes
|
# Get the image bytes
|
||||||
@ -411,7 +417,9 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
|||||||
# Handle Pictures
|
# Handle Pictures
|
||||||
drawing_blip = self.xpath_expr(shape.element)
|
drawing_blip = self.xpath_expr(shape.element)
|
||||||
if drawing_blip: # ensure there is a drwaing blip
|
if drawing_blip: # ensure there is a drwaing blip
|
||||||
self.handle_pictures(shape, parent_slide, slide_ind, doc, drawing_blip, slide)
|
self.handle_pictures(
|
||||||
|
shape, parent_slide, slide_ind, doc, drawing_blip, slide
|
||||||
|
)
|
||||||
# If shape doesn't have any text, move on to the next shape
|
# If shape doesn't have any text, move on to the next shape
|
||||||
if not hasattr(shape, "text"):
|
if not hasattr(shape, "text"):
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user