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

Function runs_merge

utils/src/utils.py:58–75  ·  view source on GitHub ↗
(paragraph: _Paragraph)

Source from the content-addressed store, hash-verified

56
57
58def runs_merge(paragraph: _Paragraph):
59 runs = paragraph.runs
60 if len(runs) == 0:
61 runs = [
62 _Run(r, paragraph)
63 for r in parse_xml(paragraph._element.xml.replace("fld", "r")).r_lst
64 ]
65 if len(runs) == 1:
66 return runs[0]
67 if len(runs) == 0:
68 return None
69 run = max(runs, key=lambda x: len(x.text))
70 run.text = paragraph.text
71
72 for r in runs:
73 if r != run:
74 r._r.getparent().remove(r._r)
75 return run
76
77
78def older_than(filepath, seconds: int = 10, wait: bool = False):

Callers 2

replace_paraFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected