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

Method getPageNumber

Lib/pagebot/document.py:1163–1177  ·  view source on GitHub ↗

Answers a tuple with the page number (pn, index), if the page can be found and there are multiple. Pages are organized as dict of lists (allowing multiple pages on the same page number) {1:[page, page, ...], 2} TODO: Make a reversed table if this squential search sh

(self, page)

Source from the content-addressed store, hash-verified

1161 return None # No previous page found.
1162
1163 def getPageNumber(self, page):
1164 """Answers a tuple with the page number (pn, index), if the page can
1165 be found and there are multiple. Pages are organized as dict of lists
1166 (allowing multiple pages on the same page number)
1167
1168 {1:[page, page, ...], 2}
1169
1170 TODO: Make a reversed table if this squential search shows to be slow
1171 in the future with large docs.
1172 """
1173 for pn, pnPages in sorted(self.pages.items()):
1174 for index, pg in enumerate(pnPages):
1175 if page is pg:
1176 return (pn, 0)
1177 return None # Cannot find this page
1178
1179 def getPageIndex(self, page):
1180 """Answer the index number of the page, if the page can be found

Callers 7

_get_indexMethod · 0.80
__repr__Method · 0.80
_get_isLeftMethod · 0.80
_get_isRightMethod · 0.80
_get_pnMethod · 0.80
drawNameInfoMethod · 0.80
getNameStringMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected