summaryrefslogtreecommitdiff
path: root/paramiko/pipe.py
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2014-03-07 20:45:26 -0800
committerScott Maxwell <scott@codecobblers.com>2014-03-07 20:45:26 -0800
commitf0017b83309899bf6fffc0fa90093c36f1a7f7ea (patch)
tree582d35dee4b32f022bddc2245731a76112f7ac8e /paramiko/pipe.py
parent073c71a8223ff77cacd8c555ef63ce24f0c3d50c (diff)
downloadparamiko-f0017b83309899bf6fffc0fa90093c36f1a7f7ea.tar.gz
Fix import * and a bunch of PEP8 formatting
Diffstat (limited to 'paramiko/pipe.py')
-rw-r--r--paramiko/pipe.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/paramiko/pipe.py b/paramiko/pipe.py
index 568aca6b..b0cfcf24 100644
--- a/paramiko/pipe.py
+++ b/paramiko/pipe.py
@@ -28,10 +28,9 @@ will trigger as readable in `select <select.select>`.
import sys
import os
import socket
-from paramiko.py3compat import b
-def make_pipe ():
+def make_pipe():
if sys.platform[:3] != 'win':
p = PosixPipe()
else:
@@ -40,34 +39,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()
@@ -77,7 +76,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)
@@ -92,13 +91,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):