Ñò
ðgcJc           @   sF   d  d k  Z  d  d k Z d  d k Td  d k Td e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   *t   SFTPAttributesc           B   s­   e  Z d  Z d Z d Z d Z d Z d Z d „  Z d d „ Z
 e e
 ƒ Z
 d „  Z d d d	 „ Z e e ƒ Z d
 „  Z d „  Z d „  Z e d „ Z e e ƒ Z d „  Z RS(   sO  
    Representation of the attributes of a file (or proxied file) for SFTP in
    client or server mode.  It attemps to mirror the object returned by
    C{os.stat} as closely as possible, so it may have the following fields,
    with the same meanings as those returned by an C{os.stat} object:
        - st_size
        - st_uid
        - st_gid
        - st_mode
        - st_atime
        - st_mtime

    Because SFTP allows flags to have other arbitrary named attributes, these
    are stored in a dict named C{attr}.  Occasionally, the filename is also
    stored, in C{filename}.
    i   i   i   i   l        c         C   sL   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ h  |  _ d S(   sX   
        Create a new (empty) SFTPAttributes object.  All fields will be empty.
        i    N(	   t   _flagst   Nonet   st_sizet   st_uidt   st_gidt   st_modet   st_atimet   st_mtimet   attr(   t   self(    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   __init__1   s    							c         C   so   |  ƒ  } | i  | _  | i | _ | i | _ | i | _ | i | _ | i | _ | d j	 o | | _ n | S(   s«  
        Create an SFTPAttributes object from an existing C{stat} object (an
        object returned by C{os.stat}).

        @param obj: an object returned by C{os.stat} (or equivalent).
        @type obj: object
        @param filename: the filename associated with this file.
        @type filename: str
        @return: new L{SFTPAttributes} object with the same attribute fields.
        @rtype: L{SFTPAttributes}
        N(   R   R   R   R   R   R	   R   t   filename(   t   clst   objR   R
   (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt	   from_stat>   s    	c         C   s   d |  i  ƒ  S(   Ns   <SFTPAttributes: %s>(   t
   _debug_str(   R   (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   __repr__V   s    c         C   sN   |  ƒ  } | i  | ƒ | d  j	 o | | _ n | d  j	 o | | _ n | S(   N(   t   _unpackR   R   t   longname(   R   t   msgR   R   R
   (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt	   _from_msg]   s    	c         C   s  | i  ƒ  |  _ |  i |  i @o | i ƒ  |  _ n |  i |  i @o" | i  ƒ  |  _ | i  ƒ  |  _ n |  i |  i @o | i  ƒ  |  _	 n |  i |  i
 @o" | i  ƒ  |  _ | i  ƒ  |  _ n |  i |  i @o@ | i  ƒ  } x1 t | ƒ D] } | i ƒ  |  i | i ƒ  <qç Wn d  S(   N(   t   get_intR   t	   FLAG_SIZEt	   get_int64R   t   FLAG_UIDGIDR   R   t   FLAG_PERMISSIONSR   t   FLAG_AMTIMER   R	   t   FLAG_EXTENDEDt   ranget
   get_stringR
   (   R   R   t   countt   i(    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyR   g   s      c         C   s&  d |  _  |  i d  j	 o |  i  |  i O_  n |  i d  j	 o& |  i d  j	 o |  i  |  i O_  n |  i d  j	 o |  i  |  i O_  n |  i	 d  j	 o& |  i
 d  j	 o |  i  |  i O_  n t |  i ƒ d j o |  i  |  i O_  n | i |  i  ƒ |  i  |  i @o | i |  i ƒ n |  i  |  i @o$ | i |  i ƒ | i |  i ƒ n |  i  |  i @o | i |  i ƒ n |  i  |  i @o0 | i t |  i	 ƒ ƒ | i t |  i
 ƒ ƒ n |  i  |  i @oT | i t |  i ƒ ƒ x; |  i i ƒ  D]& \ } } | i | ƒ | i | ƒ qôWn d  S(   Ni    (   R   R   R   R   R   R   R   R   R   R   R	   R   t   lenR
   R   t   add_intt	   add_int64t   longt	   iteritemst
   add_string(   R   R   t   keyt   val(    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   _packx   s:    	   c         C   s  d } |  i  d  j	 o | d |  i  7} n |  i d  j	 o. |  i d  j	 o | d |  i |  i f 7} n |  i d  j	 o | d t |  i ƒ d 7} n |  i d  j	 o. |  i d  j	 o | d |  i |  i f 7} n x7 |  i i	 ƒ  D]& \ } } | d t
 | ƒ | f 7} qæ W| d 7} | S(	   Ns   [ s   size=%d s   uid=%d gid=%d s   mode=t    s   atime=%d mtime=%d s   "%s"=%r t   ](   R   R   R   R   R   t   octR   R	   R
   R&   t   str(   R   t   outt   kt   v(    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyR   —   s       
c         C   sj   | o
 d } n d |  d ?d |  d ?d @} | o | d | |  d @7} n | d | |  d @7} | S(   Ni   s   -rs   -wi   s   -xTts   -xSs(    (   t   nt   suidt   stickyR/   (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   _rwx¦   s    
c         C   sa  |  i  d j	 oRt i |  i  ƒ } | t i j o
 d } n£ | t i j o
 d } n‰ | t i j o
 d } no | t i j o
 d } nU | t i j o
 d } n; | t i	 j o
 d } n! | t i
 j o
 d } n d } | |  i |  i  d	 @d
 ?|  i  t i @ƒ 7} | |  i |  i  d @d ?|  i  t i @ƒ 7} | |  i |  i  d @|  i  t i @t ƒ 7} n d } |  i d j p |  i d j o
 d } na t t i ƒ  |  i ƒ d j o" t i d t i |  i ƒ ƒ } n t i d t i |  i ƒ ƒ } t |  d d ƒ } |  i } |  i } | d j o
 d } n | d j o
 d } n d | | | |  i | | f S(   s=   create a unix-style long description of the file (like ls -l)t   pt   ct   dt   bt   -t   lt   st   ?iÀ  i   i8   i   i   s
   ?---------l   ÿÿ s   (unknown date)i Ní s   %d %b %Ys   %d %b %H:%MR   i    s   %s   1 %-8d %-8d %8d %-12s %sN(   R   R   t   statt   S_IFMTt   S_IFIFOt   S_IFCHRt   S_IFDIRt   S_IFBLKt   S_IFREGt   S_IFLNKt   S_IFSOCKR5   t   S_ISUIDt   S_ISGIDt   S_ISVTXt   TrueR	   t   abst   timet   strftimet	   localtimet   getattrR   R   R   (   R   t   kindt   kst   datestrR   t   uidt   gid(    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   __str__±   sD    






++. 
 "		

N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R   t   classmethodR   R   R   R*   R   t   FalseR5   t   staticmethodRU   (    (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyR      s$   						(   R>   RL   t   paramiko.commont   paramiko.sftpt   objectR   (    (    (    sQ   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\sftp_attr.pyt   <module>   s   

