Skip to content

Commit

Permalink
fix: fixed unpacking issues after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-kmiecik committed Oct 30, 2024
1 parent f2582a0 commit 6eb94de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/unstructured_client/_hooks/custom/split_pdf_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def _get_pdf_pages(
split_size: int = 1,
page_start: int = 1,
page_end: Optional[int] = None
) -> Generator[Tuple[io.BytesIO, int, int], None, None]:
) -> Generator[Tuple[io.BytesIO, int], None, None]:
"""Reads given bytes of a pdf file and split it into n file-like objects, each
with `split_size` pages.
Expand Down Expand Up @@ -410,10 +410,10 @@ def _get_pdf_pages(
new_pdf.add_page(page)
with open(tempdir_path / f"chunk_{chunk_no}.pdf", "wb") as pdf_chunk:
new_pdf.write(pdf_chunk)
pdf_chunks.append((pdf_chunk.name, offset, offset_end))
pdf_chunks.append((pdf_chunk.name, offset))
offset += split_size

for pdf_chunk_filename, offset, offset_end in pdf_chunks:
for pdf_chunk_filename, offset in pdf_chunks:
pdf_chunk_file = None
try:
pdf_chunk_file = open( # pylint: disable=consider-using-with
Expand All @@ -423,7 +423,7 @@ def _get_pdf_pages(
except Exception: # pylint: disable=broad-except
if pdf_chunk_file and not pdf_chunk_file.closed:
pdf_chunk_file.close()
yield pdf_chunk_file, offset, offset_end
yield pdf_chunk_file, offset

def _await_elements(
self, operation_id: str) -> Optional[list]:
Expand Down

0 comments on commit 6eb94de

Please sign in to comment.