MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / ppt_validate

Function ppt_validate

utils/src/experiment/crawler.py:89–109  ·  view source on GitHub ↗
(filename: str)

Source from the content-addressed store, hash-verified

87
88
89def ppt_validate(filename: str):
90 with tempfile.TemporaryDirectory() as temp_dir:
91 config = Config(rundir=temp_dir, debug=False)
92 try:
93 presentation = Presentation.from_file(filename, config)
94 except Exception as e:
95 return False
96 num_images = len(os.listdir(config.IMAGE_DIR))
97 if num_images > 3 * len(presentation) or num_images == 0:
98 return False
99 if len(presentation) < 8 or len(presentation) > 64:
100 return False
101 if len(presentation.error_history) > len(presentation) / 2:
102 return False
103 layout_count = defaultdict(int)
104
105 for slide in presentation.slides:
106 layout_count[slide.slide_layout_name] += 1
107 if sum(layout_count.values()) / len(layout_count) < 2:
108 return False
109 return True
110
111
112def pdf_validate(filename: str):

Callers 1

gather_filesFunction · 0.70

Calls 2

ConfigClass · 0.90
from_fileMethod · 0.45

Tested by

no test coverage detected