Remove more redundant uses of .keys()

Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2018-03-11 22:37:00 +00:00
parent 44173c57e8
commit 8d91eb2bcc

View file

@ -1620,7 +1620,7 @@ def styleInheritedFromParent(node, style):
# check styles first (they take precedence over presentation attributes)
styles = _getStyle(parentNode)
if style in styles.keys():
if style in styles:
value = styles[style]
if not value == 'inherit':
return value
@ -1660,7 +1660,7 @@ def styleInheritedByChild(node, style, nodeIsChild=False):
return False
# check styles
styles = _getStyle(node)
if (style in styles.keys()) and not (styles[style] == 'inherit'):
if (style in styles) and not (styles[style] == 'inherit'):
return False
else:
# if the passed-in node does not have any children 'style' can obviously not be inherited
@ -3229,7 +3229,7 @@ def serializeXML(element, options, indent_depth=0, preserveWhitespace=False):
if name in attrName2Index:
attrIndices.append(attrName2Index[name])
del attrName2Index[name]
attrIndices += [attrName2Index[name] for name in sorted(attrName2Index.keys())]
attrIndices += [attrName2Index[name] for name in sorted(attrName2Index)]
for index in attrIndices:
attr = attrList.item(index)