MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / ve_maker

Method ve_maker

src/__init__.py:6999–7015  ·  view source on GitHub ↗
(ve)

Source from the content-addressed store, hash-verified

6997 all_ocgs = set(doc.get_ocgs().keys())
6998
6999 def ve_maker(ve):
7000 if type(ve) not in (list, tuple) or len(ve) < 2:
7001 raise ValueError(f"bad 've' format: {ve}")
7002 if ve[0].lower() not in ("and", "or", "not"):
7003 raise ValueError(f"bad operand: {ve[0]}")
7004 if ve[0].lower() == "not" and len(ve) != 2:
7005 raise ValueError(f"bad 've' format: {ve}")
7006 item = f"[/{ve[0].title()}"
7007 for x in ve[1:]:
7008 if type(x) is int:
7009 if x not in all_ocgs:
7010 raise ValueError(f"bad OCG {x}")
7011 item += f" {x} 0 R"
7012 else:
7013 item += f" {ve_maker(x)}"
7014 item += "]"
7015 return item
7016
7017 text = "<</Type/OCMD"
7018

Callers

nothing calls this directly

Calls 2

ve_makerFunction · 0.85
titleMethod · 0.80

Tested by

no test coverage detected