Skip to content

Commit

Permalink
Beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-reiss committed May 22, 2024
1 parent 1eab844 commit cc8af1b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ def __init__(
self.flattened_pages: Optional[List[PageObject]] = None
#: Storage of parsed PDF objects.
self.resolved_objects: Dict[Tuple[Any, Any], Optional[PdfObject]] = {}

self.xref_index = 0
self.xref: Dict[int, Dict[Any, Any]] = {}
self.xref_free_entry: Dict[int, Dict[Any, Any]] = {}
self.xref_objStm: Dict[int, Tuple[Any, Any]] = {}
self.trailer = DictionaryObject()

self._page_id2num: Optional[
Dict[Any, Any]
] = None # map page indirect_reference number to Page Number
Expand Down Expand Up @@ -165,6 +171,12 @@ def __exit__(
exc_tb: Optional[TracebackType],
) -> None:
self.stream.close()
self.flattened_pages = []
self.resolved_objects = {}
self.trailer = {}
self.xref = {}
self.xref_free_entry = {}
self.xref_objStm = {}

Check warning on line 179 in pypdf/_reader.py

View check run for this annotation

Codecov / codecov/patch

pypdf/_reader.py#L173-L179

Added lines #L173 - L179 were not covered by tests

@property
def root_object(self) -> DictionaryObject:
Expand Down Expand Up @@ -789,9 +801,9 @@ def _read_standard_xref_table(self, stream: StreamType) -> None:
def _read_xref_tables_and_trailers(
self, stream: StreamType, startxref: Optional[int], xref_issue_nr: int
) -> None:
self.xref: Dict[int, Dict[Any, Any]] = {}
self.xref_free_entry: Dict[int, Dict[Any, Any]] = {}
self.xref_objStm: Dict[int, Tuple[Any, Any]] = {}
self.xref = {}
self.xref_free_entry = {}
self.xref_objStm = {}
self.trailer = DictionaryObject()
while startxref is not None:
# load the xref table
Expand Down

0 comments on commit cc8af1b

Please sign in to comment.