diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-10-11 18:48:43 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-10-11 18:48:43 -0700 |
commit | b6a8d077b3d9a5adb8e2020bcd813bb7b2ecbf70 (patch) | |
tree | b2ff0085f9e17443a5f053fd83e612aa843a3f75 | |
parent | fe9dd1b326464d162141e042d939ba56cfde18d1 (diff) |
flake8
-rw-r--r-- | paramiko/sftp_file.py | 9 | ||||
-rw-r--r-- | paramiko/sftp_server.py | 2 | ||||
-rw-r--r-- | paramiko/transport.py | 23 |
3 files changed, 22 insertions, 12 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index be7e6eac..b1c0f849 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -288,7 +288,8 @@ class SFTPFile (BufferedFile): :param int mode: new permissions """ - self.sftp._log(DEBUG, 'chmod({}, {!r})'.format(hexlify(self.handle), mode)) + self.sftp._log(DEBUG, 'chmod({}, {!r})'.format( + hexlify(self.handle), mode)) attr = SFTPAttributes() attr.st_mode = mode self.sftp._request(CMD_FSETSTAT, self.handle, attr) @@ -325,7 +326,8 @@ class SFTPFile (BufferedFile): """ if times is None: times = (time.time(), time.time()) - self.sftp._log(DEBUG, 'utime({}, {!r})'.format(hexlify(self.handle), times)) + self.sftp._log(DEBUG, 'utime({}, {!r})'.format( + hexlify(self.handle), times)) attr = SFTPAttributes() attr.st_atime, attr.st_mtime = times self.sftp._request(CMD_FSETSTAT, self.handle, attr) @@ -473,7 +475,8 @@ class SFTPFile (BufferedFile): .. versionadded:: 1.5.4 """ - self.sftp._log(DEBUG, 'readv({}, {!r})'.format(hexlify(self.handle), chunks)) + self.sftp._log(DEBUG, 'readv({}, {!r})'.format( + hexlify(self.handle), chunks)) read_chunks = [] for offset, size in chunks: diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index a6f43217..f8c4f727 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -100,7 +100,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): def start_subsystem(self, name, transport, channel): self.sock = channel - self._log(DEBUG, 'Started sftp server on channel {}'.format(repr(channel))) + self._log(DEBUG, 'Started sftp server on channel {!r}'.format(channel)) self._send_server_version() self.server.session_started() while True: diff --git a/paramiko/transport.py b/paramiko/transport.py index f5178885..3394417c 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -415,7 +415,8 @@ class Transport(threading.Thread, ClosingContextManager): """ Returns a string representation of this object, for debugging. """ - out = '<paramiko.Transport at {}'.format(hex(long(id(self)) & xffffffff)) + id_ = hex(long(id(self)) & xffffffff) + out = '<paramiko.Transport at {}'.format(id_) if not self.active: out += ' (unconnected)' else: @@ -425,7 +426,8 @@ class Transport(threading.Thread, ClosingContextManager): self._cipher_info[self.local_cipher]['key-size'] * 8 ) if self.is_authenticated(): - out += ' (active; {:d} open channel(s))'.format(len(self._channels)) + out += ' (active; {} open channel(s))'.format( + len(self._channels)) elif self.initial_kex_done: out += ' (connected; awaiting auth)' else: @@ -1186,7 +1188,8 @@ class Transport(threading.Thread, ClosingContextManager): key.get_name(), repr(key.asbytes()), )) raise SSHException('Bad host key from server') - self._log(DEBUG, 'Host key verified ({})'.format(hostkey.get_name())) + self._log(DEBUG, 'Host key verified ({})'.format( + hostkey.get_name())) if (pkey is not None) or (password is not None) or gss_auth or gss_kex: if gss_auth: @@ -1907,7 +1910,8 @@ class Transport(threading.Thread, ClosingContextManager): if len(self._expected_packet) > 0: continue else: - self._log(WARNING, 'Oops, unhandled type {:d}'.format(ptype)) + err = 'Oops, unhandled type {:d}'.format(ptype) + self._log(WARNING, err) msg = Message() msg.add_byte(cMSG_UNIMPLEMENTED) msg.add_int(m.seqno) @@ -2447,7 +2451,8 @@ class Transport(threading.Thread, ClosingContextManager): ERROR, 'Secsh channel {:d} open FAILED: {}: {}'.format( chanid, reason_str, reason_text, - )) + ) + ) self.lock.acquire() try: self.saved_exception = ChannelException(reason, reason_text) @@ -2483,7 +2488,8 @@ class Transport(threading.Thread, ClosingContextManager): DEBUG, 'Incoming x11 connection from {}:{:d}'.format( origin_addr, origin_port, - )) + ) + ) self.lock.acquire() try: my_chanid = self._next_channel() @@ -2498,7 +2504,8 @@ class Transport(threading.Thread, ClosingContextManager): DEBUG, 'Incoming tcp forwarded connection from {}:{:d}'.format( origin_addr, origin_port, - )) + ) + ) self.lock.acquire() try: my_chanid = self._next_channel() @@ -2638,7 +2645,7 @@ class SecurityOptions (object): """ Returns a string representation of this object, for debugging. """ - return '<paramiko.SecurityOptions for {}>'.format(repr(self._transport)) + return '<paramiko.SecurityOptions for {!r}>'.format(self._transport) def _set(self, name, orig, x): if type(x) is list: |