2021.10 #41

Merged
edraft merged 53 commits from 2021.10 into master 2021-10-04 09:32:42 +02:00
3 changed files with 21 additions and 26 deletions
Showing only changes of commit c115afd736 - Show all commits

View File

@ -9,9 +9,8 @@ from .._query.contains import contains_query
from .._query.count import count_query
from .._query.distinct import distinct_query
from .._query.element_at import element_at_query, element_at_or_default_query
from .._query.first import first_or_default_query, first_query
from .._query.first_last import first_or_default_query, first_query, last_or_default_query, last_query
from .._query.for_each import for_each_query
from .._query.last import last_query, last_or_default_query
from .._query.order_by import order_by_query, order_by_descending_query
from .._query.single import single_query, single_or_default_query
from .._query.where import where_query

View File

@ -1,24 +0,0 @@
from typing import Optional
from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, IndexOutOfRangeException
from cpl_query.extension.iterable_abc import IterableABC
def first_query(_list: IterableABC) -> any:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if len(_list) == 0:
raise IndexOutOfRangeException()
return _list[0]
def first_or_default_query(_list: IterableABC) -> Optional[any]:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if len(_list) == 0:
return None
return _list[0]

View File

@ -4,6 +4,26 @@ from cpl_query.exceptions import ArgumentNoneException, ExceptionArgument, Index
from cpl_query.extension.iterable_abc import IterableABC
def first_query(_list: IterableABC) -> any:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if len(_list) == 0:
raise IndexOutOfRangeException()
return _list[0]
def first_or_default_query(_list: IterableABC) -> Optional[any]:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)
if len(_list) == 0:
return None
return _list[0]
def last_query(_list: IterableABC) -> any:
if _list is None:
raise ArgumentNoneException(ExceptionArgument.list)