Skip to content

Commit f2ad642

Browse files
committed
Fix pylint errors
1 parent fe6a6a3 commit f2ad642

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/unstructured_client/_hooks/custom/form_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def get_page_range(form_data: FormData, key: str, max_pages: int) -> tuple[int,
3939
else:
4040
page_range = (1, max_pages)
4141

42-
except (ValueError, IndexError):
42+
except (ValueError, IndexError) as exc:
4343
msg = f"{_page_range} is not a valid page range."
4444
logger.error(msg)
45-
raise ValueError(msg)
45+
raise ValueError(msg) from exc
4646

4747
start, end = page_range
4848

49-
if not (0 < start <= max_pages) or not (0 < end <= max_pages) or not (start <= end):
49+
if not 0 < start <= max_pages or not 0 < end <= max_pages or not start <= end:
5050
msg = f"Page range {page_range} is out of bounds. Valid range is (1 - {max_pages})."
5151
logger.error(msg)
5252
raise ValueError(msg)

src/unstructured_client/_hooks/custom/split_pdf_hook.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ def before_request(
166166
)
167167

168168
page_count = min(len(pdf.pages), page_range_end - page_range_start + 1)
169-
logger.info(f"Splitting pages {page_range_start} to {page_range_end} ({page_count} total)")
169+
logger.info(
170+
"Splitting pages %d to %d (%d total)",
171+
page_range_start,
172+
page_range_end,
173+
page_count,
174+
)
170175

171176
split_size = get_optimal_split_size(
172177
num_pages=page_count, concurrency_level=concurrency_level

0 commit comments

Comments
 (0)