flake8 fixes

This commit is contained in:
Eric Lapouyade 2020-10-19 14:16:07 +02:00
parent 344a7d1676
commit 4af6f2282f
2 changed files with 7 additions and 8 deletions

View File

@ -248,17 +248,16 @@ class DocxTemplate(object):
def resolve_run(paragraph_properties, m):
run_properties = re.search(r'<w:rPr>.*</w:rPr>', m[0])
run_properties = run_properties[0] if run_properties else ''
p_resolve_text = lambda x: resolve_text(run_properties, paragraph_properties, x)
return re.sub(r'<w:t(?:[^>]*)?>.*?</w:t>', p_resolve_text, m[0], flags=re.DOTALL)
return re.sub(r'<w:t(?:[^>]*)?>.*?</w:t>',
lambda x: resolve_text(run_properties, paragraph_properties, x), m[0],
flags=re.DOTALL)
def resolve_paragraph(m):
paragraph_properties = re.search(r'<w:pPr>.*</w:pPr>', m[0])
paragraph_properties = paragraph_properties[0] if paragraph_properties else ''
p_resolve_run = lambda x: resolve_run(paragraph_properties, x)
return re.sub(r'<w:r(?:[^>]*)?>.*?</w:r>', p_resolve_run, m[0], flags=re.DOTALL)
return re.sub(r'<w:r(?:[^>]*)?>.*?</w:r>',
lambda x: resolve_run(paragraph_properties, x),
m[0], flags=re.DOTALL)
xml = re.sub(r'<w:p(?:[^>]*)?>.*?</w:p>', resolve_paragraph, xml, flags=re.DOTALL)

View File

@ -19,7 +19,7 @@ Now, does not require Listing() Object
Here is a \t tab\a
Here is a new paragraph\a
Here is a page break : \f
That's it
That's it
""",
}