Skip to content

Commit

Permalink
fix mypy error
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTomRod committed May 4, 2023
1 parent 7ac4e68 commit ef3595a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pypdf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,8 @@ def __str__(self) -> str:

def __repr__(self) -> str:
return f"File(name={self.name}, data: {_human_readable_bytes(len(self.data))}, hash: {hash(self.data)})"


def default_delete_decide_function(an: Any, obj: Any) -> bool:
"""Default delete_decide_function used in _writer.remove_annots_from_page"""
return True
5 changes: 2 additions & 3 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
StreamType,
_get_max_pdf_version_header,
b_,
default_delete_decide_function,
deprecate_with_replacement,
deprecation_bookmark,
deprecation_with_replacement,
Expand Down Expand Up @@ -1948,9 +1949,7 @@ def is_google_link(an: ArrayObject, obj: DictionaryObject) -> bool:
Default behaviour: remove all annotations
"""
if delete_decide_function is None:

def delete_decide_function(an: ArrayObject, obj: DictionaryObject) -> bool:
return True
delete_decide_function = default_delete_decide_function

page = cast(DictionaryObject, page.get_object())
if PG.ANNOTS in page:
Expand Down

0 comments on commit ef3595a

Please sign in to comment.