(node)
| 436 | |
| 437 | # Flatten nested elements with only one child of the same type |
| 438 | def flatten_nested_elements(node): |
| 439 | for child in node.contents: |
| 440 | if isinstance(child, element.Tag): |
| 441 | flatten_nested_elements(child) |
| 442 | if len(child.contents) == 1 and child.contents[0].name == child.name: |
| 443 | # print('Flattening:', child.name) |
| 444 | child_content = child.contents[0] |
| 445 | child.replace_with(child_content) |
| 446 | |
| 447 | return node |
| 448 | |
| 449 | body = flatten_nested_elements(body) |
| 450 |
no outgoing calls
no test coverage detected
searching dependent graphs…