Added avg query

This commit is contained in:
2021-07-27 09:26:30 +02:00
parent 0f85d4b9bc
commit e0b7728719
5 changed files with 60 additions and 2 deletions

View File

@@ -1,9 +1,10 @@
from typing import Optional, Callable
from typing import Optional, Callable, Union
from cpl_query._extension.ordered_iterable import OrderedIterable
from cpl_query.extension.ordered_iterable_abc import OrderedIterableABC
from .._query.all_query import all_query
from .._query.any_query import any_query
from .._query.avg_query import avg_query
from .._query.first_query import first_or_default_query, first_query
from .._query.for_each_query import for_each_query
from .._query.order_by import order_by_query, order_by_descending_query
@@ -23,6 +24,9 @@ class Iterable(IterableABC):
def all(self, func: Callable) -> bool:
return all_query(self, func)
def average(self, t: type, func: Callable) -> Union[int, float, complex]:
return avg_query(self, t, func)
def first(self) -> any:
return first_query(self)