diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-01-09 21:29:04 -0500 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-01-09 23:26:00 -0500 |
commit | 74eae059e2ae71044e31a580bc4ede1057c0053b (patch) | |
tree | 8c26afc3ce0c0c6494352791fd79b59ad222fb7f /paramiko/file.py | |
parent | 4495c4054233c5f7b3c4ffb3fb52ca525bc0d983 (diff) | |
download | paramiko-74eae059e2ae71044e31a580bc4ede1057c0053b.tar.gz |
Remove py3compat.PY2, including related streamlining
Diffstat (limited to 'paramiko/file.py')
-rw-r--r-- | paramiko/file.py | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/paramiko/file.py b/paramiko/file.py index 90f4a7b9..91579f60 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -22,7 +22,7 @@ from paramiko.common import ( linefeed_byte, cr_byte_value, ) -from paramiko.py3compat import BytesIO, PY2, u, bytes_types, text_type +from paramiko.py3compat import BytesIO, u, bytes_types, text_type from paramiko.util import ClosingContextManager @@ -93,39 +93,20 @@ class BufferedFile(ClosingContextManager): self._wbuffer = BytesIO() return - if PY2: - - def next(self): - """ - Returns the next line from the input, or raises - ``StopIteration`` when EOF is hit. Unlike Python file - objects, it's okay to mix calls to `next` and `readline`. - - :raises: ``StopIteration`` -- when the end of the file is reached. - - :returns: a line (`str`) read from the file. - """ - line = self.readline() - if not line: - raise StopIteration - return line - - else: - - def __next__(self): - """ - Returns the next line from the input, or raises ``StopIteration`` - when EOF is hit. Unlike python file objects, it's okay to mix - calls to `.next` and `.readline`. + def __next__(self): + """ + Returns the next line from the input, or raises ``StopIteration`` + when EOF is hit. Unlike python file objects, it's okay to mix + calls to `.next` and `.readline`. - :raises: ``StopIteration`` -- when the end of the file is reached. + :raises: ``StopIteration`` -- when the end of the file is reached. - :returns: a line (`str`) read from the file. - """ - line = self.readline() - if not line: - raise StopIteration - return line + :returns: a line (`str`) read from the file. + """ + line = self.readline() + if not line: + raise StopIteration + return line def readable(self): """ |