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

22 lines
438 B
Python
Raw Normal View History

2022-03-22 15:13:27 +00:00
#!/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