From 4af6f2282fa83aadbccafede9feb610c5faac762 Mon Sep 17 00:00:00 2001 From: Eric Lapouyade Date: Mon, 19 Oct 2020 14:16:07 +0200 Subject: [PATCH] flake8 fixes --- docxtpl/__init__.py | 13 ++++++------- tests/escape.py | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index b4a1b8d..b2cee80 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -248,17 +248,16 @@ class DocxTemplate(object): def resolve_run(paragraph_properties, m): run_properties = re.search(r'.*', 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']*)?>.*?', p_resolve_text, m[0], flags=re.DOTALL) + return re.sub(r']*)?>.*?', + lambda x: resolve_text(run_properties, paragraph_properties, x), m[0], + flags=re.DOTALL) def resolve_paragraph(m): paragraph_properties = re.search(r'.*', 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']*)?>.*?', p_resolve_run, m[0], flags=re.DOTALL) + return re.sub(r']*)?>.*?', + lambda x: resolve_run(paragraph_properties, x), + m[0], flags=re.DOTALL) xml = re.sub(r']*)?>.*?', resolve_paragraph, xml, flags=re.DOTALL) diff --git a/tests/escape.py b/tests/escape.py index 1559a11..c4281a5 100644 --- a/tests/escape.py +++ b/tests/escape.py @@ -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 """, }