File: find.py

package info (click to toggle)
python-agate 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,008 kB
  • sloc: python: 8,578; makefile: 126
file content (17 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def find(self, test):
    """
    Find the first row that passes a test.

    :param test:
        A function that takes a :class:`.Row` and returns :code:`True` if
        it matches.
    :type test:
        :class:`function`
    :returns:
        A single :class:`.Row` if found, or `None`.
    """
    for row in self._rows:
        if test(row):
            return row

    return None