[blivet:master 6/9] Get rid of a redefined builtin while simplifying method.

Anne Mulhern amulhern at redhat.com
Thu Apr 24 11:47:18 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Thursday, April 24, 2014 1:48:08 AM
> Subject: Re: [blivet:master 6/9] Get rid of a redefined builtin while	simplifying method.
> 
> On Wed, 2014-04-23 at 17:49 -0400, mulhern wrote:
> > Signed-off-by: mulhern <amulhern at redhat.com>
> > ---
> >  blivet/devices.py | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/blivet/devices.py b/blivet/devices.py
> > index 9d04bb7..7db528d 100644
> > --- a/blivet/devices.py
> > +++ b/blivet/devices.py
> > @@ -1931,13 +1931,9 @@ class DMDevice(StorageDevice):
> >  
> >      @property
> >      def status(self):
> > -        _status = False
> > -        for map in block.dm.maps():
> > -            if map.name == self.mapName:
> > -                _status = map.live_table and not map.suspended
> > -                break
> > -
> > -        return _status
> > +        match = next((m for m in block.dm.maps() if m.name ==
> > self.mapName),
> > +           None)
> > +        return match.live_table and not match.suspended if match else
> > False
> Much nicer than the previous version! Just please add parentheses around
> the part before 'if' that should make the line better readable.
> 
> --
> Vratislav Podzimek
> 
> Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Done.

- mulhern


More information about the anaconda-patches mailing list