diff options
author | Michael Williamson <mike@zwobble.org> | 2013-09-29 17:52:59 +0100 |
---|---|---|
committer | Michael Williamson <mike@zwobble.org> | 2014-09-07 18:35:52 +0100 |
commit | e0b323d7fb0d355bf7fcc469d3a24bd5a55f7ee4 (patch) | |
tree | 52dd4271bd26d476ae19937bf308451c836626e3 | |
parent | b14aedee595ba673d58e04014ff6be65963740da (diff) |
Turn BufferedFile into a context manager
-rw-r--r-- | paramiko/file.py | 4 | ||||
-rw-r--r-- | paramiko/sftp_file.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/paramiko/file.py b/paramiko/file.py index 2238f0bf..09998829 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -19,8 +19,10 @@ from paramiko.common import linefeed_byte_value, crlf, cr_byte, linefeed_byte, \ cr_byte_value from paramiko.py3compat import BytesIO, PY2, u, b, bytes_types +from paramiko.util import ClosingContextManager -class BufferedFile (object): + +class BufferedFile (ClosingContextManager): """ Reusable base class to implement Python-style file buffering around a simpler stream. diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index e0fb2297..d0a37da3 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -34,10 +34,9 @@ from paramiko.py3compat import long from paramiko.sftp import CMD_CLOSE, CMD_READ, CMD_DATA, SFTPError, CMD_WRITE, \ CMD_STATUS, CMD_FSTAT, CMD_ATTRS, CMD_FSETSTAT, CMD_EXTENDED from paramiko.sftp_attr import SFTPAttributes -from paramiko.util import ClosingContextManager -class SFTPFile (BufferedFile, ClosingContextManager): +class SFTPFile (BufferedFile): """ Proxy object for a file on the remote server, in client mode SFTP. |