[PATCH 1/2] Fix pylint errors about dangerous default values
David Shea
dshea at redhat.com
Wed Mar 5 14:55:03 UTC 2014
On 03/05/2014 05:33 AM, Vratislav Podzimek wrote:
> On Tue, 2014-03-04 at 15:45 -0500, David Shea wrote:
>> 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()
> You could replace those two lines with
> skip_dds = skip_dds or set()
>
> but ACK to whichever of those two ways looks better to you.
>
I went with the original so we're not replacing the argument if skip_dds
actually is an empty set.
More information about the anaconda-patches
mailing list