[elbe-devel] [PATCH 6/6] elbepack: treeutils: use textwrap.dedent
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Jan 27 09:59:20 CET 2025
textwrap.dedent() is a bit more robust and general than the custom code.
Continue discarding all trailing and leading whitespace.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/treeutils.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index 2e9a2526016d9e53d2a22ebd2488da952a8e418f..c7306cdbaf0ba0272f0b795f7001fabbc92fd2b3 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -4,6 +4,7 @@
import copy
import os
+import textwrap
from lxml.etree import Element, ElementTree, SubElement
from lxml.etree import Resolver, XMLParser, XMLSchema, fromstring, parse, tostring
@@ -38,7 +39,7 @@ def dbsfed_schema():
def strip_leading_whitespace_from_lines(s):
- return '\n'.join(line.strip(' \t') for line in s.strip().splitlines())
+ return textwrap.dedent(s.strip())
class eiter:
--
2.48.1
More information about the elbe-devel
mailing list