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

Function get_label_pno

src_classic/utils.py:4757–4773  ·  view source on GitHub ↗

Return the label for this page number. Args: pgNo: page number, 0-based. labels: result of doc._get_page_labels(). Returns: The label (str) of the page number. Errors return an empty string.

(pgNo, labels)

Source from the content-addressed store, hash-verified

4755
4756
4757def get_label_pno(pgNo, labels):
4758 """Return the label for this page number.
4759
4760 Args:
4761 pgNo: page number, 0-based.
4762 labels: result of doc._get_page_labels().
4763 Returns:
4764 The label (str) of the page number. Errors return an empty string.
4765 """
4766 # Jorj McKie, 2021-01-06
4767
4768 item = [x for x in labels if x[0] <= pgNo][-1]
4769 rule = rule_dict(item)
4770 prefix = rule.get("prefix", "")
4771 style = rule.get("style", "")
4772 pagenumber = pgNo - rule["startpage"] + rule["firstpagenum"]
4773 return construct_label(style, prefix, pagenumber)
4774
4775
4776def get_label(page):

Callers 2

get_labelFunction · 0.70
get_page_numbersFunction · 0.70

Calls 3

rule_dictFunction · 0.70
construct_labelFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…