summaryrefslogtreecommitdiff
path: root/paramiko/pipe.py
diff options
context:
space:
mode:
authorSebastian Deiss <s.deiss@science-computing.de>2014-03-26 11:39:26 +0100
committerSebastian Deiss <s.deiss@science-computing.de>2014-03-26 11:39:26 +0100
commita23d9bc654b5278f1ab43df825ed559e4f9a2332 (patch)
tree593ae35cd2b7f550f5b9ff3d4babac57f072e741 /paramiko/pipe.py
parent5407b1a27468d5abedde93b51aad5bd97bd046c4 (diff)
parentbd8f96d33a3e1ee6162540a6f230ef93e435528a (diff)
downloadparamiko-a23d9bc654b5278f1ab43df825ed559e4f9a2332.tar.gz
Merge branch 'master' into gssapi-py3-support
Conflicts: .gitignore README demos/demo_simple.py dev-requirements.txt paramiko/__init__.py paramiko/_winapi.py paramiko/agent.py paramiko/auth_handler.py paramiko/ber.py paramiko/buffered_pipe.py paramiko/channel.py paramiko/client.py paramiko/common.py paramiko/dsskey.py paramiko/ecdsakey.py paramiko/file.py paramiko/hostkeys.py paramiko/kex_gex.py paramiko/kex_group1.py paramiko/message.py paramiko/packet.py paramiko/pkey.py paramiko/primes.py paramiko/proxy.py paramiko/py3compat.py paramiko/server.py paramiko/sftp_client.py paramiko/transport.py paramiko/util.py paramiko/win_pageant.py setup.py sites/shared_conf.py sites/www/changelog.rst sites/www/conf.py sites/www/index.rst sites/www/installing.rst test.py tests/loop.py tests/stub_sftp.py tests/test_auth.py tests/test_client.py tests/test_file.py tests/test_hostkeys.py tests/test_kex.py tests/test_message.py tests/test_packetizer.py tests/test_pkey.py tests/test_sftp.py tests/test_sftp_big.py tests/test_transport.py tests/test_util.py
Diffstat (limited to 'paramiko/pipe.py')
-rw-r--r--paramiko/pipe.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/paramiko/pipe.py b/paramiko/pipe.py
index 619b807e..4f62d7c5 100644
--- a/paramiko/pipe.py
+++ b/paramiko/pipe.py
@@ -17,11 +17,12 @@
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
"""
-Abstraction of a one-way pipe where the read end can be used in select().
-Normally this is trivial, but Windows makes it nearly impossible.
+Abstraction of a one-way pipe where the read end can be used in
+`select.select`. Normally this is trivial, but Windows makes it nearly
+impossible.
The pipe acts like an Event, which can be set or cleared. When set, the pipe
-will trigger as readable in select().
+will trigger as readable in `select <select.select>`.
"""
import sys
@@ -30,7 +31,7 @@ import socket
from paramiko.py3compat import b
-def make_pipe ():
+def make_pipe():
if sys.platform[:3] != 'win':
p = PosixPipe()
else:
@@ -39,34 +40,34 @@ def make_pipe ():
class PosixPipe (object):
- def __init__ (self):
+ def __init__(self):
self._rfd, self._wfd = os.pipe()
self._set = False
self._forever = False
self._closed = False
- def close (self):
+ def close(self):
os.close(self._rfd)
os.close(self._wfd)
# used for unit tests:
self._closed = True
- def fileno (self):
+ def fileno(self):
return self._rfd
- def clear (self):
+ def clear(self):
if not self._set or self._forever:
return
os.read(self._rfd, 1)
self._set = False
- def set (self):
+ def set(self):
if self._set or self._closed:
return
self._set = True
os.write(self._wfd, b'*')
- def set_forever (self):
+ def set_forever(self):
self._forever = True
self.set()
@@ -76,7 +77,7 @@ class WindowsPipe (object):
On Windows, only an OS-level "WinSock" may be used in select(), but reads
and writes must be to the actual socket object.
"""
- def __init__ (self):
+ def __init__(self):
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.bind(('127.0.0.1', 0))
serv.listen(1)
@@ -91,13 +92,13 @@ class WindowsPipe (object):
self._forever = False
self._closed = False
- def close (self):
+ def close(self):
self._rsock.close()
self._wsock.close()
# used for unit tests:
self._closed = True
- def fileno (self):
+ def fileno(self):
return self._rsock.fileno()
def clear (self):