[PATCH 1/2] Fix pylint errors about dangerous default values

Vratislav Podzimek vpodzime at redhat.com
Wed Mar 5 10:33:04 UTC 2014


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.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list