aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py
diff options
context:
space:
mode:
authormonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
committermonster <monster@ydb.tech>2022-07-07 14:41:37 +0300
commit06e5c21a835c0e923506c4ff27929f34e00761c2 (patch)
tree75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py
parent03f024c4412e3aa613bb543cf1660176320ba8f4 (diff)
downloadydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz
fix ya.make
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py')
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py69
1 files changed, 0 insertions, 69 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py
deleted file mode 100644
index 197dcb9a60..0000000000
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/input/defaults.py
+++ /dev/null
@@ -1,69 +0,0 @@
-import sys
-from typing import ContextManager, Optional, TextIO
-
-from .base import DummyInput, Input, PipeInput
-
-__all__ = [
- "create_input",
- "create_pipe_input",
-]
-
-
-def create_input(
- stdin: Optional[TextIO] = None, always_prefer_tty: bool = False
-) -> Input:
- """
- Create the appropriate `Input` object for the current os/environment.
-
- :param always_prefer_tty: When set, if `sys.stdin` is connected to a Unix
- `pipe`, check whether `sys.stdout` or `sys.stderr` are connected to a
- pseudo terminal. If so, open the tty for reading instead of reading for
- `sys.stdin`. (We can open `stdout` or `stderr` for reading, this is how
- a `$PAGER` works.)
- """
- if sys.platform == "win32":
- from .win32 import Win32Input
-
- # If `stdin` was assigned `None` (which happens with pythonw.exe), use
- # a `DummyInput`. This triggers `EOFError` in the application code.
- if stdin is None and sys.stdin is None:
- return DummyInput()
-
- return Win32Input(stdin or sys.stdin)
- else:
- from .vt100 import Vt100Input
-
- # If no input TextIO is given, use stdin/stdout.
- if stdin is None:
- stdin = sys.stdin
-
- if always_prefer_tty:
- for io in [sys.stdin, sys.stdout, sys.stderr]:
- if io.isatty():
- stdin = io
- break
-
- return Vt100Input(stdin)
-
-
-def create_pipe_input() -> ContextManager[PipeInput]:
- """
- Create an input pipe.
- This is mostly useful for unit testing.
-
- Usage::
-
- with create_pipe_input() as input:
- input.send_text('inputdata')
-
- Breaking change: In prompt_toolkit 3.0.28 and earlier, this was returning
- the `PipeInput` directly, rather than through a context manager.
- """
- if sys.platform == "win32":
- from .win32_pipe import Win32PipeInput
-
- return Win32PipeInput.create()
- else:
- from .posix_pipe import PosixPipeInput
-
- return PosixPipeInput.create()