def __init__(self, sock):
BaseSFTP.__init__(self)<EOL>self.sock = sock<EOL>self.ultra_debug = False<EOL>self.request_number = <NUM_LIT:1><EOL>self._lock = threading.Lock()<EOL>self._cwd = None<EOL>self._expecting = weakref.WeakValueDictionary()<EOL>if type(sock) is Channel:<EOL><INDENT>transport = self.sock.get_transport()<EOL>self.logger = util.get_logger(transport.get_log_channel() + '<STR_LIT>')<EOL>self.ultra_debug = transport.get_hexdump()<EOL><DEDENT>try:<EOL><INDENT>server_version = self._send_version()<EOL><DEDENT>except EOFError as x:<EOL><INDENT>raise SSHException('<STR_LIT>')<EOL><DEDENT>self._log(INFO, '<STR_LIT>' % server_version)<EOL>
Create an SFTP client from an existing L{Channel}.  The channel
should already have requested the C{"sftp"} subsystem.

An alternate way to create an SFTP client context is by using
L{from_transport}.

@param sock: an open L{Channel} using the C{"sftp"} subsystem
@type sock: L{Channel}

@raise SSHException: if there's an exception while negotiating
    sftp