Skip to content

Commit 7d03601

Browse files
src/__init__.py: add Annot.__bool__().
Avoids the need to do `if annot and annot.this`.
1 parent ef3e633 commit 7d03601

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ class Annot:
586586
def __init__(self, annot):
587587
assert isinstance( annot, mupdf.PdfAnnot)
588588
self.this = annot
589+
590+
def __bool__(self):
591+
return bool(self.this)
589592

590593
def __repr__(self):
591594
parent = getattr(self, 'parent', '<>')

0 commit comments

Comments
 (0)