summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-09 22:55:48 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-09 23:26:00 -0500
commit78abb0e542ae5f74b30e5e2aa15a04a815bc55ae (patch)
tree82ba70b54e6c598ada435c4779d1450f034caf80
parent9e83ca9d8acb5e9d41d45d46a0339e2f633e2dea (diff)
string_types -> str
-rw-r--r--paramiko/client.py3
-rw-r--r--paramiko/pkey.py6
-rw-r--r--paramiko/server.py3
-rw-r--r--paramiko/sftp_server.py8
-rw-r--r--paramiko/transport.py4
-rw-r--r--tests/test_config.py4
6 files changed, 12 insertions, 16 deletions
diff --git a/paramiko/client.py b/paramiko/client.py
index 80cc2ec6..73909219 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -35,7 +35,6 @@ from paramiko.dsskey import DSSKey
from paramiko.ecdsakey import ECDSAKey
from paramiko.ed25519key import Ed25519Key
from paramiko.hostkeys import HostKeys
-from paramiko.py3compat import string_types
from paramiko.rsakey import RSAKey
from paramiko.ssh_exception import (
SSHException,
@@ -442,7 +441,7 @@ class SSHClient(ClosingContextManager):
if key_filename is None:
key_filenames = []
- elif isinstance(key_filename, string_types):
+ elif isinstance(key_filename, str):
key_filenames = [key_filename]
else:
key_filenames = key_filename
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index 254f8086..92dc32ff 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -37,7 +37,7 @@ from cryptography.hazmat.primitives.ciphers import algorithms, modes, Cipher
from paramiko import util
from paramiko.util import u, b
from paramiko.common import o600
-from paramiko.py3compat import encodebytes, decodebytes, string_types
+from paramiko.py3compat import encodebytes, decodebytes
from paramiko.ssh_exception import SSHException, PasswordRequiredException
from paramiko.message import Message
@@ -603,9 +603,9 @@ class PKey(object):
# but eg ECDSA is a 1:N mapping.
key_types = key_type
cert_types = cert_type
- if isinstance(key_type, string_types):
+ if isinstance(key_type, str):
key_types = [key_types]
- if isinstance(cert_types, string_types):
+ if isinstance(cert_types, str):
cert_types = [cert_types]
# Can't do much with no message, that should've been handled elsewhere
if msg is None:
diff --git a/paramiko/server.py b/paramiko/server.py
index 80ebf06a..f1638b64 100644
--- a/paramiko/server.py
+++ b/paramiko/server.py
@@ -29,7 +29,6 @@ from paramiko.common import (
AUTH_FAILED,
AUTH_SUCCESSFUL,
)
-from paramiko.py3compat import string_types
class ServerInterface(object):
@@ -615,7 +614,7 @@ class InteractiveQuery(object):
self.instructions = instructions
self.prompts = []
for x in prompts:
- if isinstance(x, string_types):
+ if isinstance(x, str):
self.add_prompt(x)
else:
self.add_prompt(x[0], x[1])
diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py
index b93c8168..e120e7ad 100644
--- a/paramiko/sftp_server.py
+++ b/paramiko/sftp_server.py
@@ -36,7 +36,7 @@ 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 string_types, bytes_types
+from paramiko.py3compat import bytes_types
from paramiko.server import SubsystemHandler
from paramiko.util import b
@@ -233,7 +233,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
msg.add_int64(item)
elif isinstance(item, int):
msg.add_int(item)
- elif isinstance(item, (string_types, bytes_types)):
+ elif isinstance(item, (str, bytes_types)):
msg.add_string(item)
elif type(item) is SFTPAttributes:
item._pack(msg)
@@ -409,7 +409,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
)
return
data = self.file_table[handle].read(offset, length)
- if isinstance(data, (bytes_types, string_types)):
+ if isinstance(data, (bytes_types, str)):
if len(data) == 0:
self._send_status(request_number, SFTP_EOF)
else:
@@ -501,7 +501,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
elif t == CMD_READLINK:
path = msg.get_text()
resp = self.server.readlink(path)
- if isinstance(resp, (bytes_types, string_types)):
+ if isinstance(resp, (bytes_types, str)):
self._response(
request_number, CMD_NAME, 1, resp, "", SFTPAttributes()
)
diff --git a/paramiko/transport.py b/paramiko/transport.py
index 6abfe5d8..cff51446 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -101,7 +101,7 @@ from paramiko.kex_gss import KexGSSGex, KexGSSGroup1, KexGSSGroup14
from paramiko.message import Message
from paramiko.packet import Packetizer, NeedRekeyException
from paramiko.primes import ModulusPack
-from paramiko.py3compat import string_types, input
+from paramiko.py3compat import input
from paramiko.rsakey import RSAKey
from paramiko.ecdsakey import ECDSAKey
from paramiko.server import ServerInterface
@@ -411,7 +411,7 @@ class Transport(threading.Thread, ClosingContextManager):
self.hostname = None
self.server_extensions = {}
- if isinstance(sock, string_types):
+ if isinstance(sock, str):
# convert "host:port" into (host, port)
hl = sock.split(":", 1)
self.hostname = hl[0]
diff --git a/tests/test_config.py b/tests/test_config.py
index 017d4bbf..9b86108d 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -4,8 +4,6 @@
from os.path import expanduser
from socket import gaierror
-from paramiko.py3compat import string_types
-
try:
from invoke import Result
except ImportError:
@@ -731,7 +729,7 @@ def _expect(success_on):
Single string or list of strings, noting commands that should appear to
succeed.
"""
- if isinstance(success_on, string_types):
+ if isinstance(success_on, str):
success_on = [success_on]
def inner(command, *args, **kwargs):