Tweaks to replace for loops with built-in functions and list comprehensions
svn: r12756
This commit is contained in:
parent
5da4aa816d
commit
c919910cca
@ -110,12 +110,7 @@ class EnumeratedListOption(Option):
|
||||
@type value: The type will depend on the type of option.
|
||||
@return: nothing
|
||||
"""
|
||||
found = False
|
||||
for (opt_value, opt_description) in self.__items:
|
||||
if value == opt_value:
|
||||
found = True
|
||||
|
||||
if found:
|
||||
if any(value == v for v, d in self.__items):
|
||||
Option.set_value(self, value)
|
||||
else:
|
||||
print "Value %s not found for option %s" % ( str(value),
|
||||
|
@ -62,14 +62,10 @@ class FilterOption(EnumeratedListOption):
|
||||
@type filter_list: array
|
||||
@return: nothing
|
||||
"""
|
||||
items = []
|
||||
curval = self.get_value()
|
||||
items = [(value, filt.get_name())
|
||||
for value, filt in enumerate(filter_list)]
|
||||
|
||||
value = 0
|
||||
for filt in filter_list:
|
||||
items.append((value, filt.get_name()))
|
||||
value += 1
|
||||
|
||||
self.__filters = filter_list
|
||||
self.clear()
|
||||
self.set_items( items )
|
||||
|
Loading…
Reference in New Issue
Block a user