[PATCH 1/2] Make _filterDevices() return a generator consistently (#1122081)
mulhern
amulhern at redhat.com
Fri Aug 29 21:26:33 UTC 2014
Related: fed#1122081
Previously, it returned a list when incomplete was True and a
generator when it was False.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/devicetree.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index bf90fb5..508e533 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -2235,12 +2235,13 @@ class DeviceTree(object):
:param bool incomplete: include incomplete devices in result
:param bool hidden: include hidden devices in result
- :returns: a list of devices
- :rtype: list of :class:`~.devices.Device`
+ :returns: a generator of devices
+ :rtype: generator of :class:`~.devices.Device`
"""
- devices = self._devices[:]
if hidden:
- devices += self._hidden
+ devices = (d for d in self._devices[:] + self._hidden[:])
+ else:
+ devices = (d for d in self._devices[:])
if not incomplete:
devices = (d for d in devices if getattr(d, "complete", True))
--
1.9.3
More information about the anaconda-patches
mailing list