python: Elide unnecessary list wrappers.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-09-12 14:19:57 -07:00
committed by Tim Abbott
parent eff0a73925
commit 2665a3ce2b
49 changed files with 129 additions and 142 deletions

View File

@@ -46,8 +46,8 @@ class NestedCodeBlocksRendererTreeProcessor(markdown.treeprocessors.Treeprocesso
parent.tag == "p"
and grandparent.tag == "li"
and parent.text is None
and len(list(parent)) == 1
and len(list(parent.itertext())) == 1
and len(parent) == 1
and sum(1 for text in parent.itertext()) == 1
):
# if the parent (<p>) has no text, and no children,
# that means that the <code> element inside is its