mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Docstring correction and a note about the recursion
This commit is contained in:
parent
5d1ead2e6a
commit
e7f95b0c7a
1 changed files with 3 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
def clean_indentation(element, level=0, spaces_per_level=2, trailing_indent=True):
|
||||
"""Set indentation of XML element and its sub-elements.
|
||||
Copied and pastee from https://effbot.org/zone/element-lib.htm#prettyprint.
|
||||
Copied and pasted from https://effbot.org/zone/element-lib.htm#prettyprint.
|
||||
It walks your tree and adds spaces and newlines so the tree is
|
||||
printed in a nice way.
|
||||
|
||||
|
|
@ -26,6 +26,8 @@ def clean_indentation(element, level=0, spaces_per_level=2, trailing_indent=True
|
|||
if trailing_indent and (not element.tail or not element.tail.strip()):
|
||||
element.tail = i
|
||||
for sub_element in element:
|
||||
# `trailing_indent` intentionally not passed to the recursive call.
|
||||
# it only applies to the element for the initial of this function.
|
||||
clean_indentation(sub_element, level+1, spaces_per_level)
|
||||
if not sub_element.tail or not sub_element.tail.strip():
|
||||
sub_element.tail = i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue