Bug 1363811 - Modify the name of the DependsFunction.__or__ implementation method. r=cmanchester+432261

Like the test change, it makes the intent clearer.
This commit is contained in:
Mike Hommey 2017-05-17 15:16:48 +09:00
Родитель fafb6f8f44
Коммит 91e718c2f2
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -123,13 +123,13 @@ class DependsFunction(object):
other = self.sandbox._depends.get(other) other = self.sandbox._depends.get(other)
assert isinstance(other, DependsFunction) assert isinstance(other, DependsFunction)
assert self.sandbox is other.sandbox assert self.sandbox is other.sandbox
return CombinedDependsFunction(self.sandbox, self.first_true, return CombinedDependsFunction(self.sandbox, self.or_impl,
(self, other)) (self, other))
@staticmethod @staticmethod
def first_true(iterable): def or_impl(iterable):
# Like the builtin any(), but returns the first element that is true, # Applies "or" to all the items of iterable.
# instead of True. If none are true, returns the last element. # e.g. if iterable contains a, b and c, returns `a or b or c`.
for i in iterable: for i in iterable:
if i: if i:
return i return i