Skip to content

Commit

Permalink
remove NoneType import
Browse files Browse the repository at this point in the history
  • Loading branch information
mtd91429 committed Jul 8, 2022
1 parent ba43f9d commit 2e8e19b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions PyPDF2/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import os
import re
import struct
from types import NoneType
import warnings
import zlib
from io import BytesIO
Expand Down Expand Up @@ -803,7 +802,7 @@ def _build_destination(
array = array[2:]
return Destination(title, page, typ, *array) # type: ignore
except Exception as error:
warnings.warn(f"Error when processing destination {title} {array}. {error}", PdfReadWarning)
warnings.warn(f"Error when processing destination '{title}': {error}", PdfReadWarning)
if self.strict:
raise
else:
Expand All @@ -829,7 +828,7 @@ def _build_outline(self, node: DictionaryObject) -> Optional[Destination]:
title = node["/Title"]
dest = node["/Dest"]

if isinstance(dest, ArrayObject) or isinstance(dest, NoneType):
if isinstance(dest, ArrayObject) or isinstance(dest, type(None)):
outline = self._build_destination(title, dest) # type: ignore
elif isinstance(dest, str) and dest in self._namedDests:
outline = self._namedDests[dest]
Expand Down

0 comments on commit 2e8e19b

Please sign in to comment.