Ñò
XÁÅGc           @   s2   d  d k  Z  d  d k Z d e f d „  ƒ  YZ d S(   iÿÿÿÿNt	   SmartFilec           B   sG   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sß   
    A file-like object used for writing files. The given file will only be
    actually written to disk if there's not a file with the same name, or if
    the existing file is *different* from the file to be written.
    t   wc         C   s(   | |  _  | |  _ g  |  _ t |  _ d  S(   N(   t   filenamet   modet	   _contentst   Falset   _closed(   t   selfR   R   (    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   __init__   s    			c         C   s   |  i  p |  i ƒ  n d  S(   N(   R   t   close(   R   (    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   __del__   s    
c         C   s   |  i  i | ƒ d  S(   N(   R   t   append(   R   t   string(    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   write   s    c         C   s0   t  |  i |  i ƒ } | i | ƒ | i ƒ  d  S(   N(   t   fileR   R   R   R	   (   R   t   contentst   f(    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   _dowrite#   s    c         C   s   t  i | ƒ i ƒ  S(   N(   t   md5t   newt   digest(   R   R   (    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   _GetMD5)   s    c         C   s§   d i  |  i ƒ } t i i |  i ƒ p |  i | ƒ nb t |  i ƒ } | i ƒ  } | i	 ƒ  |  i
 | ƒ } |  i
 | ƒ } | | j o |  i | ƒ n t |  _ d  S(   Nt    (   t   joinR   t   ost   patht   isfileR   R   R   t   readR	   R   t   TrueR   (   R   t   this_contentsR   t   other_contentst   this_md5t	   other_md5(    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyR	   -   s    
(	   t   __name__t
   __module__t   __doc__R   R
   R   R   R   R	   (    (    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyR       s   				(   R   R   t   objectR    (    (    (    s/   /usr/lib/pymodules/python2.6/Pyste/SmartFile.pyt   <module>   s   