MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / __contains__

Method __contains__

src/__init__.py:2822–2842  ·  view source on GitHub ↗
(self, loc)

Source from the content-addressed store, hash-verified

2820class Document:
2821
2822 def __contains__(self, loc) -> bool:
2823 if type(loc) is int:
2824 if loc < self.page_count:
2825 return True
2826 return False
2827 if type(loc) not in (tuple, list) or len(loc) != 2:
2828 return False
2829 chapter, pno = loc
2830 if (0
2831 or not isinstance(chapter, int)
2832 or chapter < 0
2833 or chapter >= self.chapter_count
2834 ):
2835 return False
2836 if (0
2837 or not isinstance(pno, int)
2838 or pno < 0
2839 or pno >= self.chapter_page_count(chapter)
2840 ):
2841 return False
2842 return True
2843
2844 def __delitem__(self, i)->None:
2845 if not self.is_pdf:

Callers

nothing calls this directly

Calls 1

chapter_page_countMethod · 0.95

Tested by

no test coverage detected