Moved last queries
This commit is contained in:
parent
e7863a92e0
commit
c115afd736
@ -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
|
||||
|
@ -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]
|
@ -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)
|
Loading…
Reference in New Issue
Block a user