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

Function construct_label

src_classic/utils.py:4820–4836  ·  view source on GitHub ↗

Construct a label based on style, prefix and page number.

(style, prefix, pno)

Source from the content-addressed store, hash-verified

4818
4819
4820def construct_label(style, prefix, pno) -> str:
4821 """Construct a label based on style, prefix and page number."""
4822 # William Chapman, 2021-01-06
4823
4824 n_str = ""
4825 if style == "D":
4826 n_str = str(pno)
4827 elif style == "r":
4828 n_str = integerToRoman(pno).lower()
4829 elif style == "R":
4830 n_str = integerToRoman(pno).upper()
4831 elif style == "a":
4832 n_str = integerToLetter(pno).lower()
4833 elif style == "A":
4834 n_str = integerToLetter(pno).upper()
4835 result = prefix + n_str
4836 return result
4837
4838
4839def integerToLetter(i) -> str:

Callers 1

get_label_pnoFunction · 0.70

Calls 2

integerToRomanFunction · 0.70
integerToLetterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…