Skip to content

Commit

Permalink
Move function to bottom for type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Sep 20, 2024
1 parent 2f4365a commit 634c5d9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pypdf/generic/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,6 @@ def __repr__(self) -> str:
return "NullObject"


def is_null_or_none(x: Any) -> TypeGuard[None|NullObject|IndirectObject]:
"""
Returns:
True if x is None or NullObject.
"""
return x is None or (
isinstance(x, PdfObject) and isinstance(x.get_object(), NullObject)
)


class BooleanObject(PdfObject):
def __init__(self, value: Any) -> None:
self.value = value
Expand Down Expand Up @@ -859,3 +849,13 @@ def encode_pdfdocencoding(unicode_string: str) -> bytes:
-1,
"does not exist in translation table",
)


def is_null_or_none(x: Any) -> TypeGuard[None | NullObject | IndirectObject]:
"""
Returns:
True if x is None or NullObject.
"""
return x is None or (
isinstance(x, PdfObject) and isinstance(x.get_object(), NullObject)
)

0 comments on commit 634c5d9

Please sign in to comment.