From 48467b14b57e4b09c91551439147627d868a1d59 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sat, 30 Apr 2022 00:01:00 -0700 Subject: [PATCH] Remove utils.indent, python 3.9 provides a similar function --- comicapi/comet.py | 2 +- comicapi/comicinfoxml.py | 2 +- comicapi/utils.py | 17 ----------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/comicapi/comet.py b/comicapi/comet.py index 4dd273a..f823374 100644 --- a/comicapi/comet.py +++ b/comicapi/comet.py @@ -121,7 +121,7 @@ class CoMet: if credit["role"].lower() in set(self.editor_synonyms): ET.SubElement(root, "editor").text = str(credit["person"]) - utils.indent(root) + ET.indent(root) # wrap it in an ElementTree instance, and save as XML tree = ET.ElementTree(root) diff --git a/comicapi/comicinfoxml.py b/comicapi/comicinfoxml.py index ff3bd06..827cb9d 100644 --- a/comicapi/comicinfoxml.py +++ b/comicapi/comicinfoxml.py @@ -177,7 +177,7 @@ class ComicInfoXml: page_node = ET.SubElement(pages_node, "Page") page_node.attrib = dict(sorted(page_dict.items())) - utils.indent(root) + ET.indent(root) # wrap it in an ElementTree instance, and save as XML tree = ET.ElementTree(root) diff --git a/comicapi/utils.py b/comicapi/utils.py index 8dbfa66..bbe5a7a 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -33,23 +33,6 @@ class UtilsVars: already_fixed_encoding = False -def indent(elem, level=0): - # for making the XML output readable - i = "\n" + level * " " - if len(elem): - if not elem.text or not elem.text.strip(): - elem.text = i + " " - if not elem.tail or not elem.tail.strip(): - elem.tail = i - for ele in elem: - indent(ele, level + 1) - if not elem.tail or not elem.tail.strip(): - elem.tail = i - else: - if level and (not elem.tail or not elem.tail.strip()): - elem.tail = i - - def get_actual_preferred_encoding(): preferred_encoding = locale.getpreferredencoding() if platform.system() == "Darwin":