aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py
diff options
context:
space:
mode:
authorNikita Slyusarev <nslus@yandex-team.com>2022-02-10 16:46:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:52 +0300
commitcd77cecfc03a3eaf87816af28a33067c4f0cdb59 (patch)
tree1308e0bae862d52e0020d881fe758080437fe389 /contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py
parentcdae02d225fb5b3afbb28990e79a7ac6c9125327 (diff)
downloadydb-cd77cecfc03a3eaf87816af28a33067c4f0cdb59.tar.gz
Restoring authorship annotation for Nikita Slyusarev <nslus@yandex-team.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py')
-rw-r--r--contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py b/contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py
index f123732560..d3ed08ce86 100644
--- a/contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py
+++ b/contrib/python/prompt-toolkit/py2/prompt_toolkit/input.py
@@ -7,7 +7,7 @@ from .utils import DummyContext, is_windows
from abc import ABCMeta, abstractmethod
from six import with_metaclass
-import io
+import io
import os
import sys
@@ -63,21 +63,21 @@ class StdinInput(Input):
def __init__(self, stdin=None):
self.stdin = stdin or sys.stdin
- # The input object should be a TTY.
- assert self.stdin.isatty()
-
- # Test whether the given input object has a file descriptor.
- # (Idle reports stdin to be a TTY, but fileno() is not implemented.)
- try:
- # This should not raise, but can return 0.
- self.stdin.fileno()
- except io.UnsupportedOperation:
- if 'idlelib.run' in sys.modules:
- raise io.UnsupportedOperation(
- 'Stdin is not a terminal. Running from Idle is not supported.')
- else:
- raise io.UnsupportedOperation('Stdin is not a terminal.')
-
+ # The input object should be a TTY.
+ assert self.stdin.isatty()
+
+ # Test whether the given input object has a file descriptor.
+ # (Idle reports stdin to be a TTY, but fileno() is not implemented.)
+ try:
+ # This should not raise, but can return 0.
+ self.stdin.fileno()
+ except io.UnsupportedOperation:
+ if 'idlelib.run' in sys.modules:
+ raise io.UnsupportedOperation(
+ 'Stdin is not a terminal. Running from Idle is not supported.')
+ else:
+ raise io.UnsupportedOperation('Stdin is not a terminal.')
+
def __repr__(self):
return 'StdinInput(stdin=%r)' % (self.stdin,)
@@ -114,22 +114,22 @@ class PipeInput(Input):
def read(self):
return os.read(self._r)
- def send_text(self, data):
- " Send text to the input. "
+ def send_text(self, data):
+ " Send text to the input. "
os.write(self._w, data.encode('utf-8'))
- # Deprecated alias for `send_text`.
- send = send_text
-
+ # Deprecated alias for `send_text`.
+ send = send_text
+
def raw_mode(self):
return DummyContext()
def cooked_mode(self):
return DummyContext()
-
- def close(self):
- " Close pipe fds. "
- os.close(self._r)
- os.close(self._w)
- self._r = None
- self._w = None
+
+ def close(self):
+ " Close pipe fds. "
+ os.close(self._r)
+ os.close(self._w)
+ self._r = None
+ self._w = None