Skip to content

Commit

Permalink
MAINT: Remove unused code (#2805)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz authored Aug 22, 2024
1 parent 0c81f3c commit d2d520b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
21 changes: 4 additions & 17 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from pathlib import Path
from types import TracebackType
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Expand All @@ -47,7 +48,6 @@

from ._doc_common import PdfDocCommon, convert_to_int
from ._encryption import Encryption, PasswordType
from ._page import PageObject
from ._utils import (
StrByteType,
StreamType,
Expand Down Expand Up @@ -82,6 +82,9 @@
)
from .xmp import XmpInformation

if TYPE_CHECKING:
from ._page import PageObject


class PdfReader(PdfDocCommon):
"""
Expand Down Expand Up @@ -273,22 +276,6 @@ def xmp_metadata(self) -> Optional[XmpInformation]:
finally:
self._override_encryption = False

def _get_page(self, page_number: int) -> PageObject:
"""
Retrieve a page by number from this PDF file.
Args:
page_number: The page number to retrieve
(pages begin at zero)
Returns:
A :class:`PageObject<pypdf._page.PageObject>` instance.
"""
if self.flattened_pages is None:
self._flatten()
assert self.flattened_pages is not None, "hint for mypy"
return self.flattened_pages[page_number]

def _get_page_number_by_indirect(
self, indirect_reference: Union[None, int, NullObject, IndirectObject]
) -> Optional[int]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def test_get_form(src, expected, expected_get_fields, txt_file_path):
def test_get_page_number(src, page_number):
src = RESOURCE_ROOT / src
reader = PdfReader(src)
reader._get_page(0)
reader.get_page(0)
page = reader.pages[page_number]
assert reader.get_page_number(page) == page_number

Expand Down

0 comments on commit d2d520b

Please sign in to comment.