MCPcopy Create free account
hub / github.com/PageBot/PageBot / getPage

Method getPage

Lib/pagebot/document.py:919–931  ·  view source on GitHub ↗

Answers the page at (pn, index). Otherwise search for a page with this name. Raise index errors if it does not exist.

(self, pnOrName, index=0)

Source from the content-addressed store, hash-verified

917 appendElement = appendPage
918
919 def getPage(self, pnOrName, index=0):
920 """Answers the page at (pn, index). Otherwise search for a page with this name.
921 Raise index errors if it does not exist."""
922 if pnOrName in self.pages:
923 if index >= len(self.pages[pnOrName]):
924 return None
925 return self.pages[pnOrName][index]
926
927 # In case searching by name, chances are that multiple are answered as list.
928 pages = self.findPages(name=pnOrName)
929 if pages:
930 return pages[0]
931 return None
932
933 def getPages(self, pn):
934 """Answers all pages that share the same page number. Raise KeyError if

Callers 2

overflow2NextMethod · 0.80
overflow2NextMethod · 0.80

Calls 1

findPagesMethod · 0.95

Tested by

no test coverage detected