summaryrefslogtreecommitdiff
path: root/paramiko/pkey.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-10 14:41:59 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-10-10 14:41:59 -0700
commiteea4f62f0fb5a14eece79565145fb5589008c7e1 (patch)
treeed4c2f0f166e424004e9dd52a2251f57e4890b54 /paramiko/pkey.py
parent2f4766f7ef6442004fc9de72504de45bb577847b (diff)
downloadparamiko-eea4f62f0fb5a14eece79565145fb5589008c7e1.tar.gz
Use new(er)-style string formatting, {} instead of {0}
Diffstat (limited to 'paramiko/pkey.py')
-rw-r--r--paramiko/pkey.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index 67723be2..533d0797 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -409,7 +409,7 @@ class PKey(object):
# (requires going back into per-type subclasses.)
msg.get_string()
else:
- err = 'Invalid key (class: {0}, data type: {1}'
+ err = 'Invalid key (class: {}, data type: {}'
raise SSHException(err.format(self.__class__.__name__, type_))
def load_certificate(self, value):
@@ -439,7 +439,7 @@ class PKey(object):
constructor = 'from_string'
blob = getattr(PublicBlob, constructor)(value)
if not blob.key_type.startswith(self.get_name()):
- err = "PublicBlob type {0} incompatible with key type {1}"
+ err = "PublicBlob type {} incompatible with key type {}"
raise ValueError(err.format(blob.key_type, self.get_name()))
self.public_blob = blob
@@ -490,7 +490,7 @@ class PublicBlob(object):
"""
fields = string.split(None, 2)
if len(fields) < 2:
- msg = "Not enough fields for public blob: {0}"
+ msg = "Not enough fields for public blob: {}"
raise ValueError(msg.format(fields))
key_type = fields[0]
key_blob = decodebytes(b(fields[1]))
@@ -503,7 +503,7 @@ class PublicBlob(object):
m = Message(key_blob)
blob_type = m.get_text()
if blob_type != key_type:
- msg = "Invalid PublicBlob contents: key type={0!r}, but blob type={1!r}" # noqa
+ msg = "Invalid PublicBlob contents: key type={!r}, but blob type={!r}" # noqa
raise ValueError(msg.format(key_type, blob_type))
# All good? All good.
return cls(type_=key_type, blob=key_blob, comment=comment)
@@ -520,9 +520,9 @@ class PublicBlob(object):
return cls(type_=type_, blob=message.asbytes())
def __str__(self):
- ret = '{0} public key/certificate'.format(self.key_type)
+ ret = '{} public key/certificate'.format(self.key_type)
if self.comment:
- ret += "- {0}".format(self.comment)
+ ret += "- {}".format(self.comment)
return ret
def __eq__(self, other):