diff options
author | Dorian Pula <dorian.pula@amber-penguin-software.ca> | 2017-05-29 17:21:36 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-05-31 17:14:40 -0700 |
commit | bda557429547f4d5a4e81492c9754b3b4e1ae622 (patch) | |
tree | 431188a8f881b97814c767fc70aa0bfd3e8461e3 /paramiko/buffered_pipe.py | |
parent | fa96fe0609b335c2b97aa7ff8db0dc4fb6710ff1 (diff) | |
download | paramiko-bda557429547f4d5a4e81492c9754b3b4e1ae622.tar.gz |
Flake8 improvements for more of paramiko.
Diffstat (limited to 'paramiko/buffered_pipe.py')
-rw-r--r-- | paramiko/buffered_pipe.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/paramiko/buffered_pipe.py b/paramiko/buffered_pipe.py index 605f51e9..9a65cd95 100644 --- a/paramiko/buffered_pipe.py +++ b/paramiko/buffered_pipe.py @@ -41,7 +41,7 @@ class BufferedPipe (object): file or socket, but is fed data from another thread. This is used by `.Channel`. """ - + def __init__(self): self._lock = threading.Lock() self._cv = threading.Condition(self._lock) @@ -67,7 +67,7 @@ class BufferedPipe (object): Set an event on this buffer. When data is ready to be read (or the buffer has been closed), the event will be set. When no data is ready, the event will be cleared. - + :param threading.Event event: the event to set/clear """ self._lock.acquire() @@ -84,12 +84,12 @@ class BufferedPipe (object): event.clear() finally: self._lock.release() - + def feed(self, data): """ Feed new data into this pipe. This method is assumed to be called from a separate thread, so synchronization is done. - + :param data: the data to add, as a `str` or `bytes` """ self._lock.acquire() @@ -106,7 +106,7 @@ class BufferedPipe (object): Returns true if data is buffered and ready to be read from this feeder. A ``False`` result does not mean that the feeder has closed; it means you may need to wait before more data arrives. - + :return: ``True`` if a `read` call would immediately return at least one byte; ``False`` otherwise. @@ -135,7 +135,7 @@ class BufferedPipe (object): :param float timeout: maximum seconds to wait (or ``None``, the default, to wait forever) :return: the read data, as a `bytes` - + :raises PipeTimeout: if a timeout was specified and no data was ready before that timeout @@ -172,11 +172,11 @@ class BufferedPipe (object): self._lock.release() return out - + def empty(self): """ Clear out the buffer and return all data that was in it. - + :return: any data that was in the buffer prior to clearing it out, as a `str` @@ -190,7 +190,7 @@ class BufferedPipe (object): return out finally: self._lock.release() - + def close(self): """ Close this pipe object. Future calls to `read` after the buffer @@ -208,7 +208,7 @@ class BufferedPipe (object): def __len__(self): """ Return the number of bytes buffered. - + :return: number (`int`) of bytes buffered """ self._lock.acquire() |