Ñò
J`ìJc           @   sÑ   d  Z  d d k l Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k	 Td d k
 l Z d d k l Z d d k l Z d „  Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d S(   s   
Client-mode SFTP support.
iÿÿÿÿ(   t   hexlifyN(   t   *(   t   SFTPAttributes(   t   SSHException(   t   SFTPFilec         C   sS   y |  i  d ƒ SWn; t j
 o/ y |  i d ƒ SWqO t j
 o |  SXn Xd S(   sÑ   
    decode a string as ascii or utf8 if possible (as required by the sftp
    protocol).  if neither works, just return a byte string because the server
    probably doesn't know the filename's encoding.
    t   asciis   utf-8N(   t   encodet   UnicodeErrort   decode(   t   s(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   _to_unicode%   s    t
   SFTPClientc           B   sU  e  Z d  Z d „  Z d „  Z e e ƒ Z d „  Z d „  Z d „  Z d d „ Z	 d d „ Z
 d	 d
 d „ Z e Z d „  Z e Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d$ d „ Z d$ d „ Z d „  Z  d „  Z! d$ d  „ Z" d! „  Z# d" „  Z$ d# „  Z% RS(%   s   
    SFTP client object.  C{SFTPClient} is used to open an sftp session across
    an open ssh L{Transport} and do remote file operations.
    c         C   sì   t  i |  ƒ | |  _ t |  _ d |  _ t i ƒ  |  _ d |  _
 t i ƒ  |  _ t | ƒ t j o> |  i i ƒ  } t i | i ƒ  d ƒ |  _ | i ƒ  |  _ n y |  i ƒ  } Wn! t j
 o } t d ƒ ‚ n X|  i t d | ƒ d S(   s±  
        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
        i   s   .sftps   EOF during negotiations*   Opened sftp connection (server version %d)N(   t   BaseSFTPt   __init__t   sockt   Falset   ultra_debugt   request_numbert	   threadingt   Lockt   _lockt   Nonet   _cwdt   weakreft   WeakValueDictionaryt
   _expectingt   typet   Channelt   get_transportt   utilt
   get_loggert   get_log_channelt   loggert   get_hexdumpt   _send_versiont   EOFErrorR   t   _logt   INFO(   t   selfR   t	   transportt   server_versiont   x(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR   :   s     				c         C   s5   | i  ƒ  } | d j o d S| i d ƒ |  | ƒ S(   sB  
        Create an SFTP client channel from an open L{Transport}.

        @param t: an open L{Transport} which is already authenticated
        @type t: L{Transport}
        @return: a new L{SFTPClient} object, referring to an sftp session
            (channel) across the transport
        @rtype: L{SFTPClient}
        t   sftpN(   t   open_sessionR   t   invoke_subsystem(   t   clst   tt   chan(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   from_transport\   s
    
c         G   s•   t  | t ƒ oK x~ | D]< } t t |  ƒ i | d | |  i i ƒ  g t | ƒ Œ q Wn7 t t |  ƒ i | d | |  i i ƒ  g t | ƒ Œ d  S(   Ns
   [chan %s] (   t
   isinstancet   listt   superR   R$   R   t   get_name(   R&   t   levelt   msgt   argst   m(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR$   m   s
     >c         C   s!   |  i  t d ƒ |  i i ƒ  d S(   sY   
        Close the SFTP session and its underlying channel.

        @since: 1.4
        s   sftp session closed.N(   R$   R%   R   t   close(   R&   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR9   t   s    c         C   s   |  i  S(   sú   
        Return the underlying L{Channel} object for this SFTP session.  This
        might be useful for doing things like setting a timeout on the channel.

        @return: the SSH channel
        @rtype: L{Channel}

        @since: 1.7.1
        (   R   (   R&   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   get_channel}   s    
t   .c         C   s+   g  } |  i  | ƒ D] } | | i q ~ S(   s  
        Return a list containing the names of the entries in the given C{path}.
        The list is in arbitrary order.  It does not include the special
        entries C{'.'} and C{'..'} even if they are present in the folder.
        This method is meant to mirror C{os.listdir} as closely as possible.
        For a list of full L{SFTPAttributes} objects, see L{listdir_attr}.

        @param path: path to list (defaults to C{'.'})
        @type path: str
        @return: list of filenames
        @rtype: list of str
        (   t   listdir_attrt   filename(   R&   t   patht   _[1]t   f(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   listdir‰   s    c         C   sf  |  i  | ƒ } |  i t d | ƒ |  i t | ƒ \ } } | t j o t d ƒ ‚ n | i ƒ  } g  } xå t oÝ y |  i t	 | ƒ \ } } Wn t
 j
 o
 } Pn X| t j o t d ƒ ‚ n | i ƒ  } xx t | ƒ D]j } t | i ƒ  ƒ }	 t | i ƒ  ƒ }
 t i | |	 |
 ƒ } |	 d j o |	 d j o | i | ƒ qß qß Wqm W|  i t | ƒ | S(   sÝ  
        Return a list containing L{SFTPAttributes} objects corresponding to
        files in the given C{path}.  The list is in arbitrary order.  It does
        not include the special entries C{'.'} and C{'..'} even if they are
        present in the folder.

        The returned L{SFTPAttributes} objects will each have an additional
        field: C{longname}, which may contain a formatted string of the file's
        attributes, in unix format.  The content of this string will probably
        depend on the SFTP server implementation.

        @param path: path to list (defaults to C{'.'})
        @type path: str
        @return: list of attributes
        @rtype: list of L{SFTPAttributes}

        @since: 1.2
        s   listdir(%r)s   Expected handles   Expected name responseR;   s   ..(   t   _adjust_cwdR$   t   DEBUGt   _requestt   CMD_OPENDIRt
   CMD_HANDLEt	   SFTPErrort
   get_stringt   Truet   CMD_READDIRR#   t   CMD_NAMEt   get_intt   rangeR
   R   t	   _from_msgt   appendt	   CMD_CLOSE(   R&   R>   R.   R6   t   handlet   filelistt   et   countt   iR=   t   longnamet   attr(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR<   ˜   s2      t   riÿÿÿÿc   	      C   so  |  i  | ƒ } |  i t d | | f ƒ d } d | j p d | j o | t O} n d | j p d | j p d | j o | t O} n d | j o | t t BO} n d | j o | t t BO} n d | j o | t t BO} n t	 ƒ  } |  i
 t | | | ƒ \ } } | t j o t d ƒ ‚ n | i ƒ  } |  i t d	 | | t | ƒ f ƒ t |  | | | ƒ S(
   sO  
        Open a file on the remote server.  The arguments are the same as for
        python's built-in C{file} (aka C{open}).  A file-like object is
        returned, which closely mimics the behavior of a normal python file
        object.

        The mode indicates how the file is to be opened: C{'r'} for reading,
        C{'w'} for writing (truncating an existing file), C{'a'} for appending,
        C{'r+'} for reading/writing, C{'w+'} for reading/writing (truncating an
        existing file), C{'a+'} for reading/appending.  The python C{'b'} flag
        is ignored, since SSH treats all files as binary.  The C{'U'} flag is
        supported in a compatible way.

        Since 1.5.2, an C{'x'} flag indicates that the operation should only
        succeed if the file was created and did not previously exist.  This has
        no direct mapping to python's file flags, but is commonly known as the
        C{O_EXCL} flag in posix.

        The file will be buffered in standard python style by default, but
        can be altered with the C{bufsize} parameter.  C{0} turns off
        buffering, C{1} uses line buffering, and any number greater than 1
        (C{>1}) uses that specific buffer size.

        @param filename: name of the file to open
        @type filename: str
        @param mode: mode (python-style) to open in
        @type mode: str
        @param bufsize: desired buffering (-1 = default buffer size)
        @type bufsize: int
        @return: a file object representing the open file
        @rtype: SFTPFile

        @raise IOError: if the file could not be opened.
        s   open(%r, %r)i    RX   t   +t   wt   aR)   s   Expected handles   open(%r, %r) -> %s(   RB   R$   RC   t   SFTP_FLAG_READt   SFTP_FLAG_WRITEt   SFTP_FLAG_CREATEt   SFTP_FLAG_TRUNCt   SFTP_FLAG_APPENDt   SFTP_FLAG_EXCLR   RD   t   CMD_OPENRF   RG   RH   R    R   (	   R&   R=   t   modet   bufsizet   imodet	   attrblockR.   R6   RQ   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   openÄ   s(    #'	#c         C   s7   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ d S(   s-  
        Remove the file at the given path.  This only works on files; for
        removing folders (directories), use L{rmdir}.

        @param path: path (absolute or relative) of the file to remove
        @type path: str

        @raise IOError: if the path refers to a folder (directory)
        s
   remove(%r)N(   RB   R$   RC   RD   t
   CMD_REMOVE(   R&   R>   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   removeÿ   s    
c         C   sO   |  i  | ƒ } |  i  | ƒ } |  i t d | | f ƒ |  i t | | ƒ d S(   sP  
        Rename a file or folder from C{oldpath} to C{newpath}.

        @param oldpath: existing name of the file or folder
        @type oldpath: str
        @param newpath: new name for the file or folder
        @type newpath: str

        @raise IOError: if C{newpath} is a folder, or something else goes
            wrong
        s   rename(%r, %r)N(   RB   R$   RC   RD   t
   CMD_RENAME(   R&   t   oldpatht   newpath(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   rename  s    iÿ  c         C   sR   |  i  | ƒ } |  i t d | | f ƒ t ƒ  } | | _ |  i t | | ƒ d S(   s™  
        Create a folder (directory) named C{path} with numeric mode C{mode}.
        The default mode is 0777 (octal).  On some systems, mode is ignored.
        Where it is used, the current umask value is first masked out.

        @param path: name of the folder to create
        @type path: str
        @param mode: permissions (posix-style) for the newly-created folder
        @type mode: int
        s   mkdir(%r, %r)N(   RB   R$   RC   R   t   st_modeRD   t	   CMD_MKDIR(   R&   R>   Rc   RW   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   mkdir   s
    		c         C   s7   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ d S(   s}   
        Remove the folder named C{path}.

        @param path: name of the folder to remove
        @type path: str
        s	   rmdir(%r)N(   RB   R$   RC   RD   t	   CMD_RMDIR(   R&   R>   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   rmdir1  s    c         C   se   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ \ } } | t j o t d ƒ ‚ n t i | ƒ S(   s3  
        Retrieve information about a file on the remote system.  The return
        value is an object whose attributes correspond to the attributes of
        python's C{stat} structure as returned by C{os.stat}, except that it
        contains fewer fields.  An SFTP server may return as much or as little
        info as it wants, so the results may vary from server to server.

        Unlike a python C{stat} object, the result may not be accessed as a
        tuple.  This is mostly due to the author's slack factor.

        The fields supported are: C{st_mode}, C{st_size}, C{st_uid}, C{st_gid},
        C{st_atime}, and C{st_mtime}.

        @param path: the filename to stat
        @type path: str
        @return: an object containing attributes about the given file
        @rtype: SFTPAttributes
        s   stat(%r)s   Expected attributes(	   RB   R$   RC   RD   t   CMD_STATt	   CMD_ATTRSRG   R   RN   (   R&   R>   R.   R6   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   stat<  s    c         C   se   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ \ } } | t j o t d ƒ ‚ n t i | ƒ S(   sd  
        Retrieve information about a file on the remote system, without
        following symbolic links (shortcuts).  This otherwise behaves exactly
        the same as L{stat}.

        @param path: the filename to stat
        @type path: str
        @return: an object containing attributes about the given file
        @rtype: SFTPAttributes
        s	   lstat(%r)s   Expected attributes(	   RB   R$   RC   RD   t	   CMD_LSTATRt   RG   R   RN   (   R&   R>   R.   R6   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   lstatV  s    c         C   sf   |  i  | ƒ } |  i t d | | f ƒ t | ƒ t j o | i d ƒ } n |  i t | | ƒ d S(   sÿ   
        Create a symbolic link (shortcut) of the C{source} path at
        C{destination}.

        @param source: path of the original file
        @type source: str
        @param dest: path of the newly created symlink
        @type dest: str
        s   symlink(%r, %r)s   utf-8N(   RB   R$   RC   R   t   unicodeR   RD   t   CMD_SYMLINK(   R&   t   sourcet   dest(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   symlinkh  s
    
c         C   sR   |  i  | ƒ } |  i t d | | f ƒ t ƒ  } | | _ |  i t | | ƒ d S(   sA  
        Change the mode (permissions) of a file.  The permissions are
        unix-style and identical to those used by python's C{os.chmod}
        function.

        @param path: path of the file to change the permissions of
        @type path: str
        @param mode: new permissions
        @type mode: int
        s   chmod(%r, %r)N(   RB   R$   RC   R   Rn   RD   t   CMD_SETSTAT(   R&   R>   Rc   RW   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   chmodx  s
    		c         C   s_   |  i  | ƒ } |  i t d | | | f ƒ t ƒ  } | | | _ | _ |  i t | | ƒ d S(   sØ  
        Change the owner (C{uid}) and group (C{gid}) of a file.  As with
        python's C{os.chown} function, you must pass both arguments, so if you
        only want to change one, use L{stat} first to retrieve the current
        owner and group.

        @param path: path of the file to change the owner and group of
        @type path: str
        @param uid: new owner's uid
        @type uid: int
        @param gid: new group id
        @type gid: int
        s   chown(%r, %r, %r)N(   RB   R$   RC   R   t   st_uidt   st_gidRD   R}   (   R&   R>   t   uidt   gidRW   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   chown‰  s
    	c         C   s„   |  i  | ƒ } | d j o t i ƒ  t i ƒ  f } n |  i t d | | f ƒ t ƒ  } | \ | _ | _ |  i t	 | | ƒ d S(   sÉ  
        Set the access and modified times of the file specified by C{path}.  If
        C{times} is C{None}, then the file's access and modified times are set
        to the current time.  Otherwise, C{times} must be a 2-tuple of numbers,
        of the form C{(atime, mtime)}, which is used to set the access and
        modified times, respectively.  This bizarre API is mimicked from python
        for the sake of consistency -- I apologize.

        @param path: path of the file to modify
        @type path: str
        @param times: C{None} or a tuple of (access time, modified time) in
            standard internet epoch time (seconds since 01 January 1970 GMT)
        @type times: tuple(int)
        s   utime(%r, %r)N(
   RB   R   t   timeR$   RC   R   t   st_atimet   st_mtimeRD   R}   (   R&   R>   t   timesRW   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   utime  s    	c         C   sR   |  i  | ƒ } |  i t d | | f ƒ t ƒ  } | | _ |  i t | | ƒ d S(   s\  
        Change the size of the file specified by C{path}.  This usually extends
        or shrinks the size of the file, just like the C{truncate()} method on
        python file objects.

        @param path: path of the file to modify
        @type path: str
        @param size: the new size of the file
        @type size: int or long
        s   truncate(%r, %r)N(   RB   R$   RC   R   t   st_sizeRD   R}   (   R&   R>   t   sizeRW   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   truncate´  s
    		c         C   s§   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ \ } } | t j o t d ƒ ‚ n | i ƒ  } | d j o d S| d j o t d | ƒ ‚ n t	 | i
 ƒ  ƒ S(   s5  
        Return the target of a symbolic link (shortcut).  You can use
        L{symlink} to create these.  The result may be either an absolute or
        relative pathname.

        @param path: path of the symbolic link file
        @type path: str
        @return: target path
        @rtype: str
        s   readlink(%r)s   Expected name responsei    i   s   Readlink returned %d resultsN(   RB   R$   RC   RD   t   CMD_READLINKRK   RG   RL   R   R
   RH   (   R&   R>   R.   R6   RT   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   readlinkÅ  s    c         C   s•   |  i  | ƒ } |  i t d | ƒ |  i t | ƒ \ } } | t j o t d ƒ ‚ n | i ƒ  } | d j o t d | ƒ ‚ n t | i	 ƒ  ƒ S(   sÐ  
        Return the normalized path (on the server) of a given path.  This
        can be used to quickly resolve symbolic links or determine what the
        server is considering to be the "current folder" (by passing C{'.'}
        as C{path}).

        @param path: path to be normalized
        @type path: str
        @return: normalized form of the given path
        @rtype: str

        @raise IOError: if the path can't be resolved on the server
        s   normalize(%r)s   Expected name responsei   s   Realpath returned %d results(
   RB   R$   RC   RD   t   CMD_REALPATHRK   RG   RL   R
   RH   (   R&   R>   R.   R6   RT   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt	   normalizeÜ  s    c         C   s‚   | d j o d |  _ d St i |  i | ƒ i ƒ p, t t i d t i	 t i ƒ | f ƒ ‚ n |  i
 | ƒ i d ƒ |  _ d S(   sE  
        Change the "current directory" of this SFTP session.  Since SFTP
        doesn't really have the concept of a current working directory, this
        is emulated by paramiko.  Once you use this method to set a working
        directory, all operations on this SFTPClient object will be relative
        to that path. You can pass in C{None} to stop using a current working
        directory.

        @param path: new current working directory
        @type path: str

        @raise IOError: if the requested path doesn't exist on the server

        @since: 1.4
        Ns   %s: %ss   utf-8(   R   R   Ru   t   S_ISDIRRn   RG   t   errnot   ENOTDIRt   ost   strerrorR   R   (   R&   R>   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   chdirô  s    	,c         C   s   |  i  S(   s9  
        Return the "current working directory" for this SFTP session, as
        emulated by paramiko.  If no directory has been set with L{chdir},
        this method will return C{None}.

        @return: the current working directory on the server, or C{None}
        @rtype: str

        @since: 1.4
        (   R   (   R&   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   getcwd  s    c   
   
   C   s  t  i | ƒ i } t | d ƒ } z¬ |  i | d ƒ } | i t ƒ d } zu xn t of | i d ƒ } t | ƒ d j o Pn | i | ƒ | t | ƒ 7} | d j	 o | | | ƒ qO qO WWd | i
 ƒ  XWd | i
 ƒ  X|  i | ƒ }	 |	 i | j o t d |	 i | f ƒ ‚ n |	 S(   s'  
        Copy a local file (C{localpath}) to the SFTP server as C{remotepath}.
        Any exception raised by operations will be passed through.  This
        method is primarily provided as a convenience.

        The SFTP operations use pipelining for speed.

        @param localpath: the local file to copy
        @type localpath: str
        @param remotepath: the destination path on the SFTP server
        @type remotepath: str
        @param callback: optional callback function that accepts the bytes
            transferred so far and the total bytes to be transferred
            (since 1.7.4)
        @type callback: function(int, int)
        @return: an object containing attributes about the given file
            (since 1.7.4)
        @rtype: SFTPAttributes

        @since: 1.4
        t   rbt   wbi    i €  Ns   size mismatch in put!  %d != %d(   R“   Ru   R‰   t   filet   set_pipelinedRI   t   readt   lent   writeR   R9   t   IOError(
   R&   t	   localpatht
   remotepatht   callbackt	   file_sizet   flt   frRŠ   t   dataR	   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   put  s,     c   
   
   C   s  |  i  | d ƒ } |  i | ƒ i } | i ƒ  zœ t  | d ƒ } z{ d } xn t of | i d ƒ } t | ƒ d j o Pn | i | ƒ | t | ƒ 7} | d j	 o | | | ƒ qL qL WWd | i	 ƒ  XWd | i	 ƒ  Xt
 i | ƒ }	 |	 i | j o t d |	 i | f ƒ ‚ n d S(   s‡  
        Copy a remote file (C{remotepath}) from the SFTP server to the local
        host as C{localpath}.  Any exception raised by operations will be
        passed through.  This method is primarily provided as a convenience.

        @param remotepath: the remote file to copy
        @type remotepath: str
        @param localpath: the destination path on the local host
        @type localpath: str
        @param callback: optional callback function that accepts the bytes
            transferred so far and the total bytes to be transferred
            (since 1.7.4)
        @type callback: function(int, int)

        @since: 1.4
        R—   R˜   i    i €  Ns   size mismatch in get!  %d != %d(   R™   Ru   R‰   t   prefetchRI   R›   Rœ   R   R   R9   R“   Rž   (
   R&   R    RŸ   R¡   R¤   R¢   R£   RŠ   R¥   R	   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   getF  s*    
 c         G   s(   |  i  t d  ƒ | | Œ } |  i | ƒ S(   N(   t   _async_requestR   R   t   _read_response(   R&   R.   t   argt   num(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyRD   r  s    c      	   G   s7  |  i  i ƒ  zt ƒ  } | i |  i ƒ xº | D]² } t | ƒ t j o | i | ƒ q0 t | ƒ t j o | i | ƒ q0 t | ƒ t	 j o | i
 | ƒ q0 t | ƒ t j o | i | ƒ q0 t d | t | ƒ f ƒ ‚ q0 W|  i } | |  i | <|  i | t	 | ƒ ƒ |  i d 7_ Wd  |  i  i ƒ  X| S(   Ns   unknown type for %r type %ri   (   R   t   acquiret   Messaget   add_intR   R   t   intt   longt	   add_int64t   strt
   add_stringR   t   _packt	   ExceptionR   t   _send_packett   release(   R&   t   fileobjR.   R«   R6   t   itemR¬   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR©   v  s*    	  	c         C   s8  x1t  o)y |  i ƒ  \ } } Wn. t j
 o" } t d t | ƒ f ƒ ‚ n Xt | ƒ } | i ƒ  } | |  i j o0 |  i t	 d | f ƒ | d  j o Pq q n |  i | } |  i | =| | j o) | t j o |  i | ƒ n | | f S| t d  ƒ j	 o | i | | ƒ n | d  j o Pq q Wd S(   Ns   Server connection dropped: %ss   Unexpected response #%d(   NN(   RI   t   _read_packetR#   R   R³   R®   RL   R   R$   RC   R   t
   CMD_STATUSt   _convert_statusR   t   _async_response(   R&   t   waitforR.   R¥   RS   R6   R¬   R¹   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyRª     s0     

c         C   s6   x/ | |  i  i ƒ  j o |  i ƒ  | i ƒ  q Wd  S(   N(   R   t   valuesRª   t   _check_exception(   R&   R¹   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   _finish_responses¬  s     
c         C   s   | i  ƒ  } | i ƒ  } | t j o d S| t j o t | ƒ ‚ nS | t j o t t i | ƒ ‚ n0 | t	 j o t t i
 | ƒ ‚ n t | ƒ ‚ d S(   sU   
        Raises EOFError or IOError on error status; otherwise does nothing.
        N(   RL   RH   t   SFTP_OKt   SFTP_EOFR#   t   SFTP_NO_SUCH_FILERž   R‘   t   ENOENTt   SFTP_PERMISSION_DENIEDt   EACCES(   R&   R6   t   codet   text(    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR½   ±  s    c         C   s   t  | ƒ t j o | i d ƒ } n |  i d j o | St | ƒ d j o | d d j o | S|  i d j o |  i | S|  i d | S(   sr   
        Return an adjusted path if we're emulating a "current working
        directory" for the server.
        s   utf-8i    t   /N(   R   Rx   R   R   R   Rœ   (   R&   R>   (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyRB   Ã  s    $N(&   t   __name__t
   __module__t   __doc__R   R0   t   classmethodR$   R9   R:   RA   R<   Rg   R™   Ri   t   unlinkRm   Rp   Rr   Ru   Rw   R|   R~   Rƒ   Rˆ   R‹   R   R   R•   R–   R   R¦   R¨   RD   R©   Rª   RÂ   R½   RB   (    (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyR   4   sF   	"					,9														.,				t   SFTPc           B   s   e  Z d  Z RS(   s6   an alias for L{SFTPClient} for backwards compatability(   RÌ   RÍ   RÎ   (    (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyRÑ   Ô  s   (   RÎ   t   binasciiR    R‘   R“   Ru   R   R„   R   t   paramiko.sftpt   paramiko.sftp_attrR   t   paramiko.ssh_exceptionR   t   paramiko.sftp_fileR   R
   R   R   RÑ   (    (    (    sS   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_client.pyt   <module>   s    
	ÿ ÿ ¢