summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-09-08 10:58:43 -0700
committerJeff Forcier <jeff@bitprophet.org>2014-09-08 10:58:43 -0700
commit69cb2248dc442ebebf7c143534b1865a23b10f61 (patch)
tree97d6e46286b7cd3111d1c885dae7ef76607a3ce9
parente4a8f3287d67039fd2dc2c7215365bd86bf6bcf6 (diff)
Formatting and docstring tweaks re #377
-rw-r--r--paramiko/channel.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py
index ae1a06fd..38772283 100644
--- a/paramiko/channel.py
+++ b/paramiko/channel.py
@@ -43,16 +43,27 @@ from paramiko import pipe
# lower bound on the max packet size we'll accept from the remote host
MIN_PACKET_SIZE = 1024
+
def requires_open_channel(func):
- """This decorator makes sure that the channel is open, else it raises an
- SSHException."""
+ """
+ Decorator for `.Channel` methods which performs an openness check.
+
+ :raises SSHException:
+ If the wrapped method is called on an unopened `.Channel`.
+ """
@wraps(func)
def _check(self, *args, **kwds):
- if self.closed or self.eof_received or self.eof_sent or not self.active:
+ if (
+ self.closed
+ or self.eof_received
+ or self.eof_sent
+ or not self.active
+ ):
raise SSHException('Channel is not open')
return func(self, *args, **kwds)
return _check
+
class Channel (object):
"""
A secure tunnel across an SSH `.Transport`. A Channel is meant to behave