1
0
Fork 0
ptpython/ptpython/filters.py
Daniel Baumann 3623c97041
Merging upstream version 3.0.21.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-09 18:28:35 +01:00

37 lines
930 B
Python

from typing import TYPE_CHECKING
from prompt_toolkit.filters import Filter
if TYPE_CHECKING:
from .python_input import PythonInput
__all__ = ["HasSignature", "ShowSidebar", "ShowSignature", "ShowDocstring"]
class PythonInputFilter(Filter):
def __init__(self, python_input: "PythonInput") -> None:
super().__init__()
self.python_input = python_input
def __call__(self) -> bool:
raise NotImplementedError
class HasSignature(PythonInputFilter):
def __call__(self) -> bool:
return bool(self.python_input.signatures)
class ShowSidebar(PythonInputFilter):
def __call__(self) -> bool:
return self.python_input.show_sidebar
class ShowSignature(PythonInputFilter):
def __call__(self) -> bool:
return self.python_input.show_signature
class ShowDocstring(PythonInputFilter):
def __call__(self) -> bool:
return self.python_input.show_docstring