sh_cpl/src/cpl_query/_query/for_each.py

16 lines
443 B
Python
Raw Normal View History

2022-04-30 17:15:26 +02:00
from collections.abc import Callable
2021-07-25 19:15:02 +02:00
2021-07-27 09:41:51 +02:00
from cpl_query.exceptions import ExceptionArgument, ArgumentNoneException
2021-07-25 19:15:02 +02:00
from cpl_query.extension.iterable_abc import IterableABC
2021-07-27 09:41:51 +02:00
def for_each_query(_list: IterableABC, _func: Callable):
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if _func is None:
raise ArgumentNoneException(ExceptionArgument.func)
2021-07-25 19:15:02 +02:00
for element in _list:
2021-07-27 09:41:51 +02:00
_func(element)