Skip to content

Commit 6290441

Browse files
committed
fix: resolve linting issues in Direct API methods
- Fixed trailing whitespace in docstrings - Fixed blank lines containing whitespace - Fixed line length exceeding 100 characters - All ruff checks now passing This should resolve CI failures.
1 parent 0d59b22 commit 6290441

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/nutrient_dws/api/direct.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def split_pdf(
245245
input_file: Input PDF file.
246246
page_ranges: List of page range dictionaries. Each dict can contain:
247247
- 'start': Starting page index (0-based, inclusive). 0 = first page.
248-
- 'end': Ending page index (0-based, exclusive).
248+
- 'end': Ending page index (0-based, exclusive).
249249
For example: {"start": 0, "end": 2} extracts pages 0-1 (first two pages).
250250
- If 'end' is omitted from dict, extracts from 'start' to end of document.
251251
Required parameter - must provide at least one range
@@ -289,11 +289,11 @@ def split_pdf(
289289
# Validate inputs
290290
if not page_ranges:
291291
raise ValueError("page_ranges is required - must provide at least one range")
292-
292+
293293
# Limit number of ranges to prevent excessive API calls
294294
if len(page_ranges) > 50:
295295
raise ValueError("Maximum 50 page ranges allowed per split operation")
296-
296+
297297
if output_paths and len(output_paths) != len(page_ranges):
298298
raise ValueError("output_paths length must match page_ranges length")
299299

@@ -453,7 +453,10 @@ def duplicate_pdf_pages(
453453
parts.append({"file": "file", "pages": {"start": page_index, "end": page_index}})
454454
else:
455455
# For positive indexes, create single-page range with exclusive end
456-
parts.append({"file": "file", "pages": {"start": page_index, "end": page_index + 1}})
456+
parts.append({
457+
"file": "file",
458+
"pages": {"start": page_index, "end": page_index + 1}
459+
})
457460

458461
# Build instructions for duplication
459462
instructions = {"parts": parts, "actions": []}

tests/integration/test_direct_api_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ def test_split_pdf_output_paths_length_mismatch_error(self, client, sample_pdf_p
304304

305305
with pytest.raises(ValueError, match="output_paths length must match page_ranges length"):
306306
client.split_pdf(sample_pdf_path, page_ranges=page_ranges, output_paths=output_paths)
307-
307+
308308
def test_split_pdf_too_many_ranges_error(self, client, sample_pdf_path):
309309
"""Test split_pdf method with too many ranges raises error."""
310310
# Create 51 ranges (exceeds the 50 limit)
311311
page_ranges = [{"start": i, "end": i + 1} for i in range(51)]
312-
312+
313313
with pytest.raises(ValueError, match="Maximum 50 page ranges allowed"):
314314
client.split_pdf(sample_pdf_path, page_ranges=page_ranges)
315315

@@ -507,7 +507,7 @@ def test_add_page_invalid_page_count_error(self, client, sample_pdf_path):
507507
# Test negative page count
508508
with pytest.raises(ValueError, match="page_count must be at least 1"):
509509
client.add_page(sample_pdf_path, insert_index=0, page_count=-1)
510-
510+
511511
# Test excessive page count
512512
with pytest.raises(ValueError, match="page_count cannot exceed 100"):
513513
client.add_page(sample_pdf_path, insert_index=0, page_count=101)

0 commit comments

Comments
 (0)