forked from prompt-toolkit/ptpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilters.py
More file actions
38 lines (25 loc) · 805 Bytes
/
filters.py
File metadata and controls
38 lines (25 loc) · 805 Bytes
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
35
36
37
38
from __future__ import unicode_literals
from prompt_toolkit.filters import Filter
__all__ = (
'HasSignature',
'ShowSidebar',
'ShowSignature',
'ShowDocstring',
)
class PythonInputFilter(Filter):
def __init__(self, python_input):
self.python_input = python_input
def __call__(self):
raise NotImplementedError
class HasSignature(PythonInputFilter):
def __call__(self):
return bool(self.python_input.signatures)
class ShowSidebar(PythonInputFilter):
def __call__(self):
return self.python_input.show_sidebar
class ShowSignature(PythonInputFilter):
def __call__(self):
return self.python_input.show_signature
class ShowDocstring(PythonInputFilter):
def __call__(self):
return self.python_input.show_docstring