diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-01-09 22:57:10 -0500 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-01-09 23:26:00 -0500 |
commit | 6d79d42c42b7f5dc2f0c433271c9ef2cca33136c (patch) | |
tree | 738bcf40eaf5ff849506578e6687e52e369c55a6 | |
parent | 78abb0e542ae5f74b30e5e2aa15a04a815bc55ae (diff) |
bytes_types -> bytes
-rw-r--r-- | paramiko/channel.py | 3 | ||||
-rw-r--r-- | paramiko/file.py | 4 | ||||
-rw-r--r-- | paramiko/sftp_server.py | 9 |
3 files changed, 7 insertions, 9 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py index fb703c31..c8afe29e 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -43,7 +43,6 @@ from paramiko.common import ( cMSG_CHANNEL_CLOSE, ) from paramiko.message import Message -from paramiko.py3compat import bytes_types from paramiko.ssh_exception import SSHException from paramiko.file import BufferedFile from paramiko.buffered_pipe import BufferedPipe, PipeTimeout @@ -1039,7 +1038,7 @@ class Channel(ClosingContextManager): self.transport._send_user_message(m) def _feed(self, m): - if isinstance(m, bytes_types): + if isinstance(m, bytes): # passed from _feed_extended s = m else: diff --git a/paramiko/file.py b/paramiko/file.py index 51a6d409..9c2872e7 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -24,7 +24,7 @@ from paramiko.common import ( linefeed_byte, cr_byte_value, ) -from paramiko.py3compat import bytes_types, text_type +from paramiko.py3compat import text_type from paramiko.util import ClosingContextManager, u @@ -522,7 +522,7 @@ class BufferedFile(ClosingContextManager): if self.newlines is None: self.newlines = newline elif self.newlines != newline and isinstance( - self.newlines, bytes_types + self.newlines, bytes ): self.newlines = (self.newlines, newline) elif newline not in self.newlines: diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index e120e7ad..dcb24626 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -36,7 +36,6 @@ from paramiko.sftp import ( from paramiko.sftp_si import SFTPServerInterface from paramiko.sftp_attr import SFTPAttributes from paramiko.common import DEBUG -from paramiko.py3compat import bytes_types from paramiko.server import SubsystemHandler from paramiko.util import b @@ -233,7 +232,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): msg.add_int64(item) elif isinstance(item, int): msg.add_int(item) - elif isinstance(item, (str, bytes_types)): + elif isinstance(item, (str, bytes)): msg.add_string(item) elif type(item) is SFTPAttributes: item._pack(msg) @@ -341,7 +340,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): hash_obj = alg() while count < blocklen: data = f.read(offset, chunklen) - if not isinstance(data, bytes_types): + if not isinstance(data, bytes): self._send_status( request_number, data, "Unable to hash file" ) @@ -409,7 +408,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): ) return data = self.file_table[handle].read(offset, length) - if isinstance(data, (bytes_types, str)): + if isinstance(data, (bytes, str)): if len(data) == 0: self._send_status(request_number, SFTP_EOF) else: @@ -501,7 +500,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): elif t == CMD_READLINK: path = msg.get_text() resp = self.server.readlink(path) - if isinstance(resp, (bytes_types, str)): + if isinstance(resp, (bytes, str)): self._response( request_number, CMD_NAME, 1, resp, "", SFTPAttributes() ) |