[PATCH 1/4] Use enumerate() instead of getting indices of iterated items
Vratislav Podzimek
vpodzime at redhat.com
Wed May 28 08:31:07 UTC 2014
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ui/tui/spokes/storage.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 807f4d2..baf1674 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -454,9 +454,8 @@ class AutoPartSpoke(NormalTUISpoke):
# Default to clearing everything.
self.clearPartType = CLEARPART_TYPE_ALL
- for parttype in self.parttypelist:
- c = CheckboxWidget(title="%i) %s" % (self.parttypelist.index(parttype) + 1,
- _(parttype)),
+ for i, parttype in enumerate(self.parttypelist):
+ c = CheckboxWidget(title="%i) %s" % (i + 1, _(parttype)),
completed=(PARTTYPES[parttype] == self.clearPartType))
self._window += [c, ""]
@@ -520,10 +519,8 @@ class PartitionSchemeSpoke(NormalTUISpoke):
NormalTUISpoke.refresh(self, args)
schemelist = self.partschemes.keys()
- for sch in schemelist:
- box = CheckboxWidget(title="%i) %s" %(schemelist.index(sch) \
- + 1, sch), completed=(schemelist.index(sch) \
- == self._selection))
+ for i, sch in enumerate(schemelist):
+ box = CheckboxWidget(title="%i) %s" %(i + 1, sch), completed=(i == self._selection))
self._window += [box, ""]
message = _("Select a partition scheme configuration.")
--
1.9.3
More information about the anaconda-patches
mailing list