Skip to content

Commit

Permalink
fix: type of path_or_stream in PdfDocumentBackend
Browse files Browse the repository at this point in the history
Signed-off-by: Michele Dolfi <[email protected]>
  • Loading branch information
dolfim-ibm committed Aug 7, 2024
1 parent 9550db8 commit d125b25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docling/backend/abstract_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def unload(self):

class PdfDocumentBackend(ABC):
@abstractmethod
def __init__(self, path_or_stream: Iterable[Union[BytesIO, Path]]):
def __init__(self, path_or_stream: Union[BytesIO, Path]):
pass

@abstractmethod
Expand Down
5 changes: 3 additions & 2 deletions docling/backend/docling_parse_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ def unload(self):


class DoclingParseDocumentBackend(PdfDocumentBackend):
def __init__(self, path_or_stream: Iterable[Union[BytesIO, Path]]):
def __init__(self, path_or_stream: Union[BytesIO, Path]):
super().__init__(path_or_stream)
self._pdoc = pdfium.PdfDocument(path_or_stream)
# Parsing cells with docling_parser call
print("PARSING WITH DOCLING PARSE")
if isinstance(path_or_stream, BytesIO):
raise NotImplemented("This backend does not support byte streams yet.")
parser = pdf_parser()
self._parser_doc = parser.find_cells(str(path_or_stream))

Expand Down
2 changes: 1 addition & 1 deletion docling/backend/pypdfium2_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def unload(self):


class PyPdfiumDocumentBackend(PdfDocumentBackend):
def __init__(self, path_or_stream: Iterable[Union[BytesIO, Path]]):
def __init__(self, path_or_stream: Union[BytesIO, Path]):
super().__init__(path_or_stream)
self._pdoc = pdfium.PdfDocument(path_or_stream)

Expand Down

0 comments on commit d125b25

Please sign in to comment.