Avoid mutating a mutable kwarg
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
841ad54e7f
commit
fbf0c06e84
1 changed files with 5 additions and 2 deletions
|
|
@ -2109,7 +2109,7 @@ def removeDefaultAttributeValue(node, attribute):
|
||||||
"""
|
"""
|
||||||
Removes the DefaultAttribute 'attribute' from 'node' if specified conditions are fulfilled
|
Removes the DefaultAttribute 'attribute' from 'node' if specified conditions are fulfilled
|
||||||
|
|
||||||
Warning: Does NOT check if the attribute is actually valid for the passed element type for increased preformance!
|
Warning: Does NOT check if the attribute is actually valid for the passed element type for increased performance!
|
||||||
"""
|
"""
|
||||||
if not node.hasAttribute(attribute.name):
|
if not node.hasAttribute(attribute.name):
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -2134,7 +2134,7 @@ def removeDefaultAttributeValue(node, attribute):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def removeDefaultAttributeValues(node, options, tainted=set()):
|
def removeDefaultAttributeValues(node, options, tainted=None):
|
||||||
u"""'tainted' keeps a set of attributes defined in parent nodes.
|
u"""'tainted' keeps a set of attributes defined in parent nodes.
|
||||||
|
|
||||||
For such attributes, we don't delete attributes with default values."""
|
For such attributes, we don't delete attributes with default values."""
|
||||||
|
|
@ -2142,6 +2142,9 @@ def removeDefaultAttributeValues(node, options, tainted=set()):
|
||||||
if node.nodeType != Node.ELEMENT_NODE:
|
if node.nodeType != Node.ELEMENT_NODE:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if tainted is None:
|
||||||
|
tainted = set()
|
||||||
|
|
||||||
# Conditionally remove all default attributes defined in 'default_attributes' (a list of 'DefaultAttribute's)
|
# Conditionally remove all default attributes defined in 'default_attributes' (a list of 'DefaultAttribute's)
|
||||||
#
|
#
|
||||||
# For increased performance do not iterate the whole list for each element but run only on valid subsets
|
# For increased performance do not iterate the whole list for each element but run only on valid subsets
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue