summaryrefslogtreecommitdiff
path: root/paramiko/file.py
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2013-10-30 17:15:40 -0700
committerScott Maxwell <scott@codecobblers.com>2013-10-30 17:15:40 -0700
commite4e1dc2002d8a0bea1ccb28fa43d5cd5accf5520 (patch)
tree42d160f83ab887181ab9c954c2da9178ea2f23af /paramiko/file.py
parent7cdbbf4bdc864bfbbab019787857a9a06d14d7e8 (diff)
downloadparamiko-e4e1dc2002d8a0bea1ccb28fa43d5cd5accf5520.tar.gz
Fix next
Diffstat (limited to 'paramiko/file.py')
-rw-r--r--paramiko/file.py47
1 files changed, 32 insertions, 15 deletions
diff --git a/paramiko/file.py b/paramiko/file.py
index 1a8d3ee1..aca97c64 100644
--- a/paramiko/file.py
+++ b/paramiko/file.py
@@ -92,21 +92,38 @@ class BufferedFile (object):
self._wbuffer = StringIO()
return
- def next(self):
- """
- Returns the next line from the input, or raises L{StopIteration} when
- EOF is hit. Unlike python file objects, it's okay to mix calls to
- C{next} and L{readline}.
-
- @raise StopIteration: when the end of the file is reached.
-
- @return: a line read from the file.
- @rtype: str
- """
- line = self.readline()
- if not line:
- raise StopIteration
- return line
+ if PY3:
+ def __next__(self):
+ """
+ Returns the next line from the input, or raises L{StopIteration} when
+ EOF is hit. Unlike python file objects, it's okay to mix calls to
+ C{next} and L{readline}.
+
+ @raise StopIteration: when the end of the file is reached.
+
+ @return: a line read from the file.
+ @rtype: str
+ """
+ line = self.readline()
+ if not line:
+ raise StopIteration
+ return line
+ else:
+ def next(self):
+ """
+ Returns the next line from the input, or raises L{StopIteration} when
+ EOF is hit. Unlike python file objects, it's okay to mix calls to
+ C{next} and L{readline}.
+
+ @raise StopIteration: when the end of the file is reached.
+
+ @return: a line read from the file.
+ @rtype: str
+ """
+ line = self.readline()
+ if not line:
+ raise StopIteration
+ return line
def read(self, size=None):
"""