[blivet:master 12/20] Make a method terser
Brian C. Lane
bcl at redhat.com
Tue Apr 15 00:43:52 UTC 2014
On Fri, Apr 11, 2014 at 02:03:54PM -0400, mulhern wrote:
> This was prompted by some pylint complaints about variable names.
>
> 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 2671e88..dfe05ad 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -1926,13 +1926,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
> + return next((m.live_table and not m.suspended \
> + for m in block.dm.maps() if m.name == self.mapName),
> + False)
>
> def updateSysfsPath(self):
> """ Update this device's sysfs path. """
> --
> 1.8.3.1
Terse and I think much harder to understand what it is doing.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list