cpl_query.base
cpl_query.base.default_lambda
- cpl_query.base.default_lambda.default_lambda(x: object)
cpl_query.base.ordered_queryable
- class cpl_query.base.ordered_queryable.OrderedQueryable(_t: type, _values: Optional[Iterable] = None, _func: Optional[Callable] = None)
Bases:
OrderedQueryableABC
Implementation of :class: cpl_query.extension.Iterable cpl_query.extension.OrderedIterableABC
- then_by(_func: Callable) OrderedQueryableABC
Sorts OrderedList in ascending order by function
func:
Callable
list of
cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC
- then_by_descending(_func: Callable) OrderedQueryableABC
Sorts OrderedList in descending order by function
func:
Callable
list of
cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC
cpl_query.base.ordered_queryable_abc
- class cpl_query.base.ordered_queryable_abc.OrderedQueryableABC(_t: type, _values: Optional[Iterable] = None, _func: Optional[Callable] = None)
Bases:
QueryableABC
- abstract then_by(func: Callable) OrderedQueryableABC
Sorts OrderedList in ascending order by function
func:
Callable
list of
cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC
- abstract then_by_descending(func: Callable) OrderedQueryableABC
Sorts OrderedList in descending order by function
func:
Callable
list of
cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC
cpl_query.base.queryable_abc
- class cpl_query.base.queryable_abc.QueryableABC(t: Optional[type] = None, values: Optional[list] = None)
Bases:
Sequence
- all(_func: Optional[Callable] = None) bool
Checks if every element of list equals result found by function
- func:
Callable
selected value
bool
- func:
- any(_func: Optional[Callable] = None) bool
Checks if list contains result found by function
- func:
Callable
selected value
bool
- func:
- average(_func: Optional[Callable] = None) Union[int, float, complex]
Returns average value of list
- func:
Callable
selected value
Union[int, float, complex]
- func:
- contains(_value: object) bool
Checks if list contains value given by function
- value:
object
value
bool
- value:
- count(_func: Optional[Callable] = None) int
Returns length of list or count of found elements
- func:
Callable
selected value
int
- func:
- distinct(_func: Optional[Callable] = None) QueryableABC
Returns list without redundancies
- func:
Callable
selected value
- class
cpl_query.base.queryable_abc.QueryableABC
- func:
- element_at(_index: int) any
Returns element at given index
- _index:
int
index
Value at _index: any
- _index:
- element_at_or_default(_index: int) Optional[any]
Returns element at given index or None
- _index:
int
index
Value at _index: Optional[any]
- _index:
- first() any
Returns first element
First element of list: any
- first_or_default() any
Returns first element or None
First element of list: Optional[any]
- for_each(_func: Optional[Callable] = None)
Runs given function for each element of list
- func: :class: Callable
function to call
- group_by(_func: Optional[Callable] = None) QueryableABC
Groups by func
Grouped list[list[any]]: any
- last() any
Returns last element
Last element of list: any
- last_or_default() any
Returns last element or None
Last element of list: Optional[any]
- max(_func: Optional[Callable] = None) Union[int, float, complex]
Returns the highest value
- func:
Callable
selected value
Union[int, float, complex]
- func:
- median(_func=None) Union[int, float]
Return the median value of data elements
Union[int, float]
- min(_func: Optional[Callable] = None) Union[int, float, complex]
Returns the lowest value
- func:
Callable
selected value
Union[int, float, complex]
- func:
- order_by(_func: Optional[Callable] = None) QueryableABC
Sorts elements by function in ascending order
- func:
Callable
selected value
- class
cpl_query.base.queryable_abc.QueryableABC
- func:
- order_by_descending(_func: Optional[Callable] = None) QueryableABC
Sorts elements by function in descending order
- func:
Callable
selected value
- class
cpl_query.base.queryable_abc.QueryableABC
- func:
- reverse() QueryableABC
Reverses list
- class
cpl_query.base.queryable_abc.QueryableABC
- select(_func: Callable) QueryableABC
Formats each element of list to a given format
- class
cpl_query.base.queryable_abc.QueryableABC
- select_many(_func: Callable) QueryableABC
Flattens resulting lists to one
- class
cpl_query.base.queryable_abc.QueryableABC
- single() any
Returns one single element of list
Found value: any
ArgumentNoneException: when argument is None Exception: when argument is None or found more than one element
- single_or_default() Optional[any]
Returns one single element of list
Found value: Optional[any]
- skip(_index: int) QueryableABC
Skips all elements from index
- _index:
int
index
- class
cpl_query.base.queryable_abc.QueryableABC
- _index:
- skip_last(_index: int) QueryableABC
Skips all elements after index
- _index:
int
index
- class
cpl_query.base.queryable_abc.QueryableABC
- _index:
- sum(_func: Optional[Callable] = None) Union[int, float, complex]
Sum of all values
- func:
Callable
selected value
Union[int, float, complex]
- func:
- take(_index: int) QueryableABC
Takes all elements from index
- _index:
int
index
- class
cpl_query.base.queryable_abc.QueryableABC
- _index:
- take_last(_index: int) QueryableABC
Takes all elements after index
- _index:
int
index
- class
cpl_query.base.queryable_abc.QueryableABC
- _index:
- where(_func: Optional[Callable] = None) QueryableABC
Select element by function
- func:
Callable
selected value
- class
cpl_query.base.queryable_abc.QueryableABC
- func: