sh_cpl/src/cpl_query/base/ordered_queryable_abc.py

44 lines
1.2 KiB
Python
Raw Normal View History

2021-07-26 15:21:57 +02:00
from abc import abstractmethod
2022-04-30 17:15:26 +02:00
from collections.abc import Callable
2022-09-13 19:33:26 +02:00
from typing import Iterable
2021-07-26 15:21:57 +02:00
from cpl_query.base.queryable_abc import QueryableABC
2021-07-26 15:21:57 +02:00
class OrderedQueryableABC(QueryableABC):
2021-07-26 15:21:57 +02:00
@abstractmethod
def __init__(self, _t: type, _values: Iterable = None, _func: Callable = None):
QueryableABC.__init__(self, _t, _values)
2021-07-26 15:21:57 +02:00
self._funcs: list[Callable] = []
if _func is not None:
self._funcs.append(_func)
@abstractmethod
def then_by(self, func: Callable) -> 'OrderedQueryableABC':
2021-11-01 20:43:25 +01:00
r"""Sorts OrderedList in ascending order by function
Parameter
---------
func: :class:`Callable`
Returns
-------
2022-09-13 19:33:26 +02:00
list of :class:`cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC`
2021-11-01 20:43:25 +01:00
"""
pass
2021-07-26 15:21:57 +02:00
@abstractmethod
def then_by_descending(self, func: Callable) -> 'OrderedQueryableABC':
2021-11-01 20:43:25 +01:00
r"""Sorts OrderedList in descending order by function
Parameter
---------
func: :class:`Callable`
Returns
-------
2022-09-13 19:33:26 +02:00
list of :class:`cpl_query.iterable.ordered_iterable_abc.OrderedIterableABC`
2021-11-01 20:43:25 +01:00
"""
pass