Bug 1363811 - Modify the name of the DependsFunction.__or__ implementation method. r?chmanchester
Like the test change, it makes the intent clearer.
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -118,23 +118,23 @@ class DependsFunction(object):
', '.join(repr(d) for d in self.dependencies),
)
def __or__(self, other):
if isinstance(other, SandboxDependsFunction):
other = self.sandbox._depends.get(other)
assert isinstance(other, DependsFunction)
assert self.sandbox is other.sandbox
- return CombinedDependsFunction(self.sandbox, self.first_true,
+ return CombinedDependsFunction(self.sandbox, self.or_impl,
(self, other))
@staticmethod
- def first_true(iterable):
- # Like the builtin any(), but returns the first element that is true,
- # instead of True. If none are true, returns the last element.
+ def or_impl(iterable):
+ # Applies "or" to all the items of iterable.
+ # e.g. if iterable contains a, b and c, returns `a or b or c`.
for i in iterable:
if i:
return i
return i
class CombinedDependsFunction(DependsFunction):
def __init__(self, sandbox, func, dependencies):