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.
|
@type value: The type will depend on the type of option.
|
||||||
@return: nothing
|
@return: nothing
|
||||||
"""
|
"""
|
||||||
found = False
|
if any(value == v for v, d in self.__items):
|
||||||
for (opt_value, opt_description) in self.__items:
|
|
||||||
if value == opt_value:
|
|
||||||
found = True
|
|
||||||
|
|
||||||
if found:
|
|
||||||
Option.set_value(self, value)
|
Option.set_value(self, value)
|
||||||
else:
|
else:
|
||||||
print "Value %s not found for option %s" % ( str(value),
|
print "Value %s not found for option %s" % ( str(value),
|
||||||
|
@ -62,14 +62,10 @@ class FilterOption(EnumeratedListOption):
|
|||||||
@type filter_list: array
|
@type filter_list: array
|
||||||
@return: nothing
|
@return: nothing
|
||||||
"""
|
"""
|
||||||
items = []
|
|
||||||
curval = self.get_value()
|
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.__filters = filter_list
|
||||||
self.clear()
|
self.clear()
|
||||||
self.set_items( items )
|
self.set_items( items )
|
||||||
|
Loading…
Reference in New Issue
Block a user