Here are the examples of the python api django.utils.six.filter taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
View Complete Implementation : util.py
Copyright GNU General Public License v3.0
Author : Uninett
Copyright GNU General Public License v3.0
Author : Uninett
def first_true(iterable, default=None, pred=None):
"""Returns the first element of iterable that evaluates to True.
:param default: Default return value if none of the elements of iterable
were true.
:param pred: Optional predicate function to evaluate the truthfulness of
elements.
"""
return next(six.filter(pred, iterable), default)