diff options
author | Scott Maxwell <scott@codecobblers.com> | 2014-03-07 20:45:26 -0800 |
---|---|---|
committer | Scott Maxwell <scott@codecobblers.com> | 2014-03-07 20:45:26 -0800 |
commit | f0017b83309899bf6fffc0fa90093c36f1a7f7ea (patch) | |
tree | 582d35dee4b32f022bddc2245731a76112f7ac8e /paramiko/file.py | |
parent | 073c71a8223ff77cacd8c555ef63ce24f0c3d50c (diff) | |
download | paramiko-f0017b83309899bf6fffc0fa90093c36f1a7f7ea.tar.gz |
Fix import * and a bunch of PEP8 formatting
Diffstat (limited to 'paramiko/file.py')
-rw-r--r-- | paramiko/file.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/paramiko/file.py b/paramiko/file.py index 69b730e2..f57aa79f 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -15,8 +15,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with Paramiko; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -from paramiko.common import * +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 class BufferedFile (object): @@ -232,7 +233,7 @@ class BufferedFile (object): pos = line.find(linefeed_byte) if self._flags & self.FLAG_UNIVERSAL_NEWLINE: rpos = line.find(cr_byte) - if (rpos >= 0) and ((rpos < pos) or (pos < 0)): + if (rpos >= 0) and (rpos < pos or pos < 0): pos = rpos xpos = pos + 1 if (line[pos] == cr_byte_value) and (xpos < len(line)) and (line[xpos] == linefeed_byte_value): @@ -358,10 +359,8 @@ class BufferedFile (object): def closed(self): return self._closed - ### overrides... - def _read(self, size): """ (subclass override) @@ -388,10 +387,8 @@ class BufferedFile (object): """ return 0 - ### internals... - def _set_mode(self, mode='r', bufsize=-1): """ Subclasses call this method to initialize the BufferedFile. @@ -419,13 +416,13 @@ class BufferedFile (object): self._flags |= self.FLAG_READ if ('w' in mode) or ('+' in mode): self._flags |= self.FLAG_WRITE - if ('a' in mode): + if 'a' in mode: self._flags |= self.FLAG_WRITE | self.FLAG_APPEND self._size = self._get_size() self._pos = self._realpos = self._size - if ('b' in mode): + if 'b' in mode: self._flags |= self.FLAG_BINARY - if ('U' in mode): + if 'U' in mode: self._flags |= self.FLAG_UNIVERSAL_NEWLINE # built-in file objects have this attribute to store which kinds of # line terminations they've seen: |