Skip to content

Documentation for abc.py

sankaku.paginators.abc.ABCPaginator

Bases: ABC, Generic[_T]

Source code in sankaku/paginators/abc.py
class ABCPaginator(ABC, Generic[_T]):
    @abstractmethod
    def __init__(self, *args, **kwargs) -> None:
        """Abstract paginator class."""
        pass

    def __aiter__(self) -> AsyncIterator[mdl.Page[_T]]:
        return self

    async def __anext__(self) -> mdl.Page[_T]:
        try:
            return await self.next_page()
        except errors.PaginatorLastPage:
            raise StopAsyncIteration

    @abstractmethod
    async def next_page(self) -> mdl.Page[_T]:
        """Get paginator next page."""

    @abstractmethod
    def complete_params(self) -> None:
        """Complete params passed to paginator for further use."""

next_page() abstractmethod async

Get paginator next page.

Source code in sankaku/paginators/abc.py
@abstractmethod
async def next_page(self) -> mdl.Page[_T]:
    """Get paginator next page."""

complete_params() abstractmethod

Complete params passed to paginator for further use.

Source code in sankaku/paginators/abc.py
@abstractmethod
def complete_params(self) -> None:
    """Complete params passed to paginator for further use."""