1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-06-05 22:19:21 +02:00
Files
OpenVoiceOS/buildroot-external/rootfs-overlay/base/usr/lib/python3.11/site-packages/rich/pager.py
j1nx c6460b9307 [WIP] Pushed for backup.
... Do not build this as of yet ...
2023-06-01 15:16:04 +02:00

35 lines
828 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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())