sh_cpl/src/cpl_query/extension/ordered_iterable_abc.py

43 lines
1.1 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
2021-07-26 15:21:57 +02:00
2021-11-02 17:45:45 +01:00
from cpl_query.extension.iterable_abc import IterableABC
2021-07-26 15:21:57 +02:00
class OrderedIterableABC(IterableABC):
@abstractmethod
2021-11-22 20:52:10 +01:00
def __init__(self, _t: type, _func: Callable = None):
IterableABC.__init__(self, _t)
2021-07-26 15:21:57 +02:00
self._funcs: list[Callable] = []
if _func is not None:
self._funcs.append(_func)
@abstractmethod
2021-11-01 20:43:25 +01:00
def then_by(self, func: Callable) -> 'OrderedIterableABC':
r"""Sorts OrderedList in ascending order by function
Parameter
---------
func: :class:`Callable`
Returns
-------
list of :class:`cpl_query.extension.OrderedIterableABC`
"""
pass
2021-07-26 15:21:57 +02:00
@abstractmethod
2021-11-01 20:43:25 +01:00
def then_by_descending(self, func: Callable) -> 'OrderedIterableABC':
r"""Sorts OrderedList in descending order by function
Parameter
---------
func: :class:`Callable`
Returns
-------
list of :class:`cpl_query.extension.OrderedIterableABC`
"""
pass