dbt-selly/dbt-env/lib/python3.8/site-packages/agate/table/find.py

22 lines
438 B
Python

#!/usr/bin/env python
# pylint: disable=W0212
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