From b1f056fd32d74119f4d5b79534443f6236a9703d Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 10 Jan 2021 11:35:06 +0000 Subject: [PATCH] Simplif loop logic Signed-off-by: Niels Thykier --- scour/scour.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scour/scour.py b/scour/scour.py index 63493bd..70cba9b 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -1381,12 +1381,11 @@ def removeUnusedAttributesOnParent(elem): unusedAttrs[attr.nodeName] = attr.nodeValue # for each child, if at least one child inherits the parent's attribute, then remove - for childNum in range(len(childElements)): - child = childElements[childNum] + for child in childElements: inheritedAttrs = [] for name in unusedAttrs: val = child.getAttribute(name) - if val == '' or val is None or val == 'inherit': + if val == '' or val == 'inherit': inheritedAttrs.append(name) for a in inheritedAttrs: del unusedAttrs[a]