# cpl_query.extension

## cpl_query.extension.iterable_abc

class cpl_query.extension.iterable_abc.IterableABC(t: Optional[type] = None, values: Optional[list] = None)

  Bases: `ABC`, `list`

  ABC to define functions on list

  abstract all(func: Callable) → bool

    Checks if every element of list equals result found by function

    > func: `Callable`

    >   selected value

    > bool

  abstract any(func: Callable) → bool

    Checks if list contains result found by function

    > func: `Callable`

    >   selected value

    > bool

  append(_IterableABC__object: object) → None

    Adds element to list

    > __object: `object`

    >   value

  abstract average(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns average value of list

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  abstract contains(value: object) → bool

    Checks if list contains value given by function

    > value: `object`

    >   value

    > bool

  abstract count(func: Optional[Callable] = None) → int

    Returns length of list or count of found elements

    > func: `Callable`

    >   selected value

    > int

  abstract distinct(func: Optional[Callable] = None) → IterableABC

    Returns list without redundancies

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract element_at(index: int) → any

    Returns element at given index

    > index: `int`

    >   index

    > Value at index: any

  abstract element_at_or_default(index: int) → Optional[any]

    Returns element at given index or None

    > index: `int`

    >   index

    > Value at index: Optional[any]

  extend(_IterableABC__iterable: Iterable) → None

    Adds elements of given list to list

    > __iterable: :class: cpl_query.extension.iterable.Iterable

    >   index

  abstract first() → any

    Returns first element

    > First element of list: any

  abstract first_or_default() → any

    Returns first element or None

    > First element of list: Optional[any]

  abstract for_each(func: Callable)

    Runs given function for each element of list

    > func: :class: Callable

    >   function to call

  abstract last() → any

    Returns last element

    > Last element of list: any

  abstract last_or_default() → any

    Returns last element or None

    > Last element of list: Optional[any]

  abstract max(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns highest value

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  abstract min(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns highest value

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  abstract order_by(func: Callable) → IterableABC

    Sorts elements by function in ascending order

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract order_by_descending(func: Callable) → IterableABC

    Sorts elements by function in descending order

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract reverse() → IterableABC

    Reverses list

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract 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

  abstract single_or_default() → Optional[any]

    Returns one single element of list

    > Found value: Optional[any]

  abstract skip(index: int) → IterableABC

    Skips all elements from index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract skip_last(index: int) → IterableABC

    Skips all elements after index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract sum(func: Optional[Callable] = None) → Union[int, float, complex]

    Sum of all values

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  abstract take(index: int) → IterableABC

    Takes all elements from index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  abstract take_last(index: int) → IterableABC

    Takes all elements after index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  to_list() → list

    Converts :class: cpl_query.extension.iterable_abc.IterableABC to :class: list

    > class

    >   list

  property type: type
  abstract where(func: Callable) → IterableABC

    Select element by function

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

## cpl_query.extension.iterable

class cpl_query.extension.iterable.Iterable(t: Optional[type] = None, values: Optional[list] = None)

  Bases: `IterableABC`

  all(func: Callable) → bool

    Checks if every element of list equals result found by function

    > func: `Callable`

    >   selected value

    > bool

  any(func: Callable) → bool

    Checks if list contains result found by function

    > func: `Callable`

    >   selected value

    > bool

  average(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns average value of list

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  contains(value: object) → bool

    Checks if list contains value given by function

    > value: `object`

    >   value

    > bool

  count(func: Optional[Callable] = None) → int

    Returns length of list or count of found elements

    > func: `Callable`

    >   selected value

    > int

  distinct(func: Optional[Callable] = None) → IterableABC

    Returns list without redundancies

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  element_at(index: int) → any

    Returns element at given index

    > index: `int`

    >   index

    > Value at index: any

  element_at_or_default(index: int) → Optional[any]

    Returns element at given index or None

    > index: `int`

    >   index

    > Value at index: Optional[any]

  first() → any

    Returns first element

    > First element of list: any

  first_or_default() → Optional[any]

    Returns first element or None

    > First element of list: Optional[any]

  for_each(func: Callable)

    Runs given function for each element of list

    > func: :class: Callable

    >   function to call

  last() → any

    Returns last element

    > Last element of list: any

  last_or_default() → Optional[any]

    Returns last element or None

    > Last element of list: Optional[any]

  max(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns highest value

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  min(func: Optional[Callable] = None) → Union[int, float, complex]

    Returns highest value

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  order_by(func: Callable) → OrderedIterableABC

    Sorts elements by function in ascending order

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  order_by_descending(func: Callable) → OrderedIterableABC

    Sorts elements by function in descending order

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  reverse() → IterableABC

    Reverses list

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  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) → IterableABC

    Skips all elements from index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  skip_last(index: int) → IterableABC

    Skips all elements after index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  sum(func: Optional[Callable] = None) → Union[int, float, complex]

    Sum of all values

    > func: `Callable`

    >   selected value

    > Union[int, float, complex]

  take(index: int) → IterableABC

    Takes all elements from index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  take_last(index: int) → IterableABC

    Takes all elements after index

    > index: `int`

    >   index

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

  where(func: Callable) → IterableABC

    Select element by function

    > func: `Callable`

    >   selected value

    > class

    >   cpl_query.extension.iterable_abc.IterableABC

## cpl_query.extension.list

class cpl_query.extension.list.List(t: Optional[type] = None, values: Optional[list] = None)

  Bases: `Iterable`

  Implementation of :class: cpl_query.extension.iterable.Iterable

## cpl_query.extension.ordered_iterable_abc

class cpl_query.extension.ordered_iterable_abc.OrderedIterableABC(_t: type, _func: Optional[Callable] = None)

  Bases: `IterableABC`

  abstract then_by(func: Callable) → OrderedIterableABC

    Sorts OrderedList in ascending order by function

    > func: `Callable`

    > list of `cpl_query.extension.OrderedIterableABC`

  abstract then_by_descending(func: Callable) → OrderedIterableABC

    Sorts OrderedList in descending order by function

    > func: `Callable`

    > list of `cpl_query.extension.OrderedIterableABC`

## cpl_query.extension.ordered_iterable

class cpl_query.extension.ordered_iterable.OrderedIterable(_t: Optional[type] = None)

  Bases: `Iterable`, `OrderedIterableABC`

  Implementation of :class: cpl_query.extension.Iterable cpl_query.extension.OrderedIterableABC

  then_by(_func: Callable) → OrderedIterableABC

    Sorts OrderedList in ascending order by function

    > func: `Callable`

    > list of `cpl_query.extension.OrderedIterableABC`

  then_by_descending(_func: Callable) → OrderedIterableABC

    Sorts OrderedList in descending order by function

    > func: `Callable`

    > list of `cpl_query.extension.OrderedIterableABC`