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 committed by Eduard Braun
parent f8d5af0e56
commit ba7f4b5f18

View file

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