diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-10-10 18:24:34 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-10-10 18:24:38 -0700 |
commit | 29ac57f565ac94021dee46b365daa56a3d27333e (patch) | |
tree | dda22abe6f5eba8118b225c55fac2f7a09237e4e /paramiko/sftp_attr.py | |
parent | 9019b25497c2b143e06da6a393e24b67bfc848f0 (diff) | |
download | paramiko-1070-remove-python26-and-33.tar.gz |
String format modernization, part 11070-remove-python26-and-33
Choosing to skip it in some edge/corner cases where it's more harmful
than helpful. Also choosing to replace many non-%s specifiers with
regular old {} since I don't see why one would normally care. Again,
eschewing that in spots where it seems like it might matter.
Diffstat (limited to 'paramiko/sftp_attr.py')
-rw-r--r-- | paramiko/sftp_attr.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index 5597948a..ea12b2f6 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -82,7 +82,7 @@ class SFTPAttributes (object): return attr def __repr__(self): - return '<SFTPAttributes: %s>' % self._debug_str() + return '<SFTPAttributes: {}>'.format(self._debug_str()) # ...internals... @classmethod @@ -146,15 +146,15 @@ class SFTPAttributes (object): def _debug_str(self): out = '[ ' if self.st_size is not None: - out += 'size=%d ' % self.st_size + out += 'size={} '.format(self.st_size) if (self.st_uid is not None) and (self.st_gid is not None): - out += 'uid=%d gid=%d ' % (self.st_uid, self.st_gid) + out += 'uid={} gid={} '.format(self.st_uid, self.st_gid) if self.st_mode is not None: out += 'mode=' + oct(self.st_mode) + ' ' if (self.st_atime is not None) and (self.st_mtime is not None): - out += 'atime=%d mtime=%d ' % (self.st_atime, self.st_mtime) + out += 'atime={} mtime={} '.format(self.st_atime, self.st_mtime) for k, v in self.attr.items(): - out += '"%s"=%r ' % (str(k), v) + out += '"{}"={!r} '.format(str(k), v) out += ']' return out @@ -222,8 +222,12 @@ class SFTPAttributes (object): if size is None: size = 0 + # TODO: not sure this actually worked as expected beforehand, leaving + # it untouched for the time being, re: .format() upgrade, until someone + # has time to doublecheck return '%s 1 %-8d %-8d %8d %-12s %s' % ( - ks, uid, gid, size, datestr, filename) + ks, uid, gid, size, datestr, filename, + ) def asbytes(self): return b(str(self)) |