hyb
2025-12-30 399ffc4d9829f70529d3b096fe4228f7496cc566
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from abc import ABC, abstractmethod
from typing import Any
 
 
class Pager(ABC):
    """Base class for a pager."""
 
    @abstractmethod
    def show(self, content: str) -> None:
        """Show content in pager.
 
        Args:
            content (str): Content to be displayed.
        """
 
 
class SystemPager(Pager):
    """Uses the pager installed on the system."""
 
    def _pager(self, content: str) -> Any:  #  pragma: no cover
        return __import__("pydoc").pager(content)
 
    def show(self, content: str) -> None:
        """Use the same pager used by pydoc."""
        self._pager(content)
 
 
if __name__ == "__main__":  # pragma: no cover
    from .__main__ import make_test_card
    from .console import Console
 
    console = Console()
    with console.pager(styles=True):
        console.print(make_test_card())