[PATCH 1/2] Fix pylint errors about dangerous default values
David Shea
dshea at redhat.com
Tue Mar 4 20:45:40 UTC 2014
Default values are only initialized once, meaning that modifications to
parameters that are set to the default will modify the default.
---
dracut/driver-updates | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dracut/driver-updates b/dracut/driver-updates
index 313c103..4701adc 100755
--- a/dracut/driver-updates
+++ b/dracut/driver-updates
@@ -714,7 +714,7 @@ def select_iso():
return (os.path.join(mnt, dd_iso), "/media/DD-search")
-def dd_scan(skip_dds=set(), scan_dd_args=True):
+def dd_scan(skip_dds=None, scan_dd_args=True):
""" Scan the system for OEMDRV devices and and specified by dd=/dev/<device>
:param skip_dds: devices to skip when checking for OEMDRV label
@@ -725,6 +725,9 @@ def dd_scan(skip_dds=set(), scan_dd_args=True):
"""
dd_todo = set(oemdrv_list())
+ if skip_dds is None:
+ skip_dds = set()
+
if skip_dds:
dd_todo.difference_update(skip_dds)
if dd_todo:
@@ -759,7 +762,7 @@ def dd_scan(skip_dds=set(), scan_dd_args=True):
else:
break
-def dd_load(dd_todo, skip_dds=set()):
+def dd_load(dd_todo, skip_dds=None):
""" Process each Driver Disk, checking for new disks after each one.
Return the set of devices that loaded stuff from.
@@ -769,6 +772,9 @@ def dd_load(dd_todo, skip_dds=set()):
:type skip_dds: set
:returns: set of devices that have been loaded
"""
+ if skip_dds is None:
+ skip_dds = set()
+
dd_finished = set()
while dd_todo:
device = dd_todo.pop()
--
1.9.0
More information about the anaconda-patches
mailing list