From 93e38566fdfd902fa3d26636aff9a06e693aacab Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 6 Apr 2023 13:27:32 -0600 Subject: [PATCH] Removing getchildren calls --- src/wiki/core/markdown/mdx/responsivetable.py | 4 ++-- src/wiki/plugins/editsection/markdown_extensions.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wiki/core/markdown/mdx/responsivetable.py b/src/wiki/core/markdown/mdx/responsivetable.py index ea098151..19d56ade 100644 --- a/src/wiki/core/markdown/mdx/responsivetable.py +++ b/src/wiki/core/markdown/mdx/responsivetable.py @@ -28,10 +28,10 @@ class ResponsiveTableTree(Treeprocessor): def move_children(self, element1, element2): """Moves children from element1 to element2""" - for child in element1.getchildren(): + for child in list(element1): element2.append(child) # reversed is needed to safely remove items while iterating - for child in reversed(element1.getchildren()): + for child in reversed(list(element1)): element1.remove(child) def convert_to_wrapper(self, element): diff --git a/src/wiki/plugins/editsection/markdown_extensions.py b/src/wiki/plugins/editsection/markdown_extensions.py index f70d437e..874ccfd4 100644 --- a/src/wiki/plugins/editsection/markdown_extensions.py +++ b/src/wiki/plugins/editsection/markdown_extensions.py @@ -39,7 +39,7 @@ class EditSectionProcessor(Treeprocessor): sec_level = -1 sec_start = -1 - for child in node.getchildren(): + for child in list(node): match = self.HEADER_RE.match(child.tag.lower()) if not match: continue @@ -86,7 +86,7 @@ class EditSectionProcessor(Treeprocessor): cur_pos = [0] * self.level last_level = 0 - for child in node.getchildren(): + for child in list(node): match = self.HEADER_RE.match(child.tag.lower()) if not match: continue -- 2.45.2