Skip to content

Commit 1967d25

Browse files
j-t-1stefan6419846
andauthored
DEV: Remove ignore Ruff rule RET503 (#3209)
RET503: Missing explicit "return" at the end of function able to return non-"None" value. --------- Co-authored-by: Stefan <[email protected]>
1 parent e3ab6c1 commit 1967d25

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

pypdf/_page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ def _merge_page(
10831083
return self._merge_page_writer(
10841084
page2, page2transformation, ctm, over, expand
10851085
)
1086+
return None
10861087
except (AssertionError, AttributeError):
10871088
pass
10881089

@@ -1175,6 +1176,7 @@ def _merge_page(
11751176
self.replace_contents(ContentStream(new_content_array, self.pdf))
11761177
self[NameObject(PG.RESOURCES)] = new_resources
11771178
self[NameObject(PG.ANNOTS)] = new_annots
1179+
return None
11781180

11791181
def _merge_page_writer(
11801182
self,

pypdf/_writer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,7 @@ def clean_forms(
21042104

21052105
clean(content, images, forms, text_filters)
21062106
page.replace_contents(content)
2107+
return [], [] # type: ignore[return-value]
21072108

21082109
def remove_images(
21092110
self,
@@ -3080,6 +3081,7 @@ def find_outline_item(
30803081
o = cast(TreeObject, o["/Next"])
30813082
else:
30823083
return None
3084+
raise PyPdfError("This line is theoretically unreachable.") # pragma: no cover
30833085

30843086
def reset_translation(
30853087
self, reader: Union[None, PdfReader, IndirectObject] = None

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ ignore = [
179179
"PT014", # Ruff bug: Duplicate of test case at index 1 in `@pytest_mark.parametrize`
180180
"PTH123", # `open()` should be replaced by `Path.open()`
181181
"PYI042", # Type alias `mode_str_type` should be CamelCase
182-
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
183182
"RUF001", # Detect confusable Unicode-to-Unicode units. Introduces bugs
184183
"RUF002", # Detect confusable Unicode-to-Unicode units. Introduces bugs
185184
"S101", # Use of `assert` detected

tests/test_merger.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def merger_operate(merger):
2525
pdf_forms = RESOURCE_ROOT / "pdflatex-forms.pdf"
2626
pdf_pw = RESOURCE_ROOT / "libreoffice-writer-password.pdf"
2727

28-
# string path:
2928
merger.append(pdf_path)
3029
merger.append(outline)
3130
merger.append(pdf_path, pages=pypdf.pagerange.PageRange(slice(0, 0)))

0 commit comments

Comments
 (0)