ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     3
uAc                 @   s   d Z ddlmZ deekr eZdddddgZdd	lZdd	l	Z	dd	l
Z
dd	lZdd	lZd
Zdd Zg fddZdd ZdddZdddZdddZdddZd	S )z=This module contains helper functions for dealing with files.    )absolute_importxrange
issamefilelinkfilecopyfilelinkorcopyfileoverwrite_safelyNi   c             C   s"   t j| }t j|}t jj||S )N)osstatpathsamestat)path1path2s1s2 r   /usr/lib/python3.6/files.py_issamefile+   s    

r   c             C   s0   |dkrt }y
t| |S  |k
r*   dS X dS )zECheck whether two paths point to the same file (i.e. are hardlinked).TFN)	Exceptionr   )r   r   catch_stat_exceptionsr   r   r   r   2   s    
c             C   s   t | |tdrdS tjj|}tjj|}tjj|}d}xpttj	D ]b}tj
|tj |d}ytj| | W n2 tk
r } z|jtjkrn W Y dd}~X qFX d}P qFW |rtj|| dS )zUHardlink srcpath to dstpath.

    Attempt to atomically replace dstpath if it exists.)r   NF)prefixdirT)r   OSErrorr	   r   abspathdirnamebasenamerangetempfileTMP_MAXmktempextseplinkerrnoEEXISTrename)srcpathdstpathdstdnamedstbnameZ
hardlinkedattempt_dsttmper   r   r   r   >   s$    Tc       
      C   s8  t | |tdrdS tjj|}tjj|}tjj|}t| d}tj	|tjj
 |dd}tj| }|rytj|}W n tk
r   Y nX tj|j tj|j d}	xP|	dkr|jt}	y|j|	 W q   |j  |j  tj|j  Y qX qW |j  |j  tj|j| |r4tj dkr4tj| dS )zCopy srcpath to dstpath.

    Abort operation if e.g. not enough space is available.  Attempt to
    atomically replace dstpath if it exists.)r   NrbF)r   r   delete r   )r   r   r	   r   r   r   r   openr   ZNamedTemporaryFiler    r
   fchmodfilenoS_IMODEst_moderead	BLOCKSIZEwritecloseunlinknamer$   selinuxis_selinux_enabled
restorecon)
r%   r&   copy_mode_from_dstrun_restoreconr'   r(   ZsrcfileZ
dsttmpfilesdatar   r   r   r   _   s<    



c             C   s^   yt | | dS  tk
rJ } z |jtjtjtjfkr: n W Y dd}~X nX t| ||| dS )ztFirst attempt to hardlink srcpath to dstpath, if hardlinking isn't
    possible, attempt copying srcpath to dstpath.N)r   r   r"   ZEMLINKZEPERMZEXDEVr   )r%   r&   r=   r>   r+   r   r   r   r      s    
Fc             C   s  t jj|}t jj|}d}d}|r6tj dkr6d}n^y&tj|\}}|dk rZtd| W n6 tk
r }	 z|	j	t	j
krd}n W Y dd}	~	X nX |st j| | |rtj| nd}
xtttjD ]f}tj|t j |d}yt j| | W n6 tk
r" }	 z|	j	t	jkrwĂ W Y dd}	~	X qX |}
P qW |
dkrDtt	jd|r^| r^tj|
| yt j|
| W n   t j|
  Y nX |rtj| dS )zpCreate a symlink, optionally replacing dstpath atomically, optionally
    setting or preserving SELinux context.FNr   zgetfilecon(%r) failedT)r   r   z/No suitable temporary symlink could be created.)r	   r   r   r   r:   r;   ZlgetfileconRuntimeErrorr   r"   ENOENTsymlinkr<   r   r   r   r   r    r#   IOErrorZlsetfileconr$   remove)r%   r&   forcepreserve_contextr'   r(   r>   ctxretr+   Zdsttmpr)   r*   r   r   r   symlink_atomically   sV    

rJ   c             C   s~  t jj| } t jj| }t jj| }d}d}d}	t jj| }
|rPtj dkrPd}ztj	|t jj
 |d\}}	|
rt j| }|rt j||j|j |rt j|tj|j |rtj| \}}|dk rtd|  t j|d}d}|j| |j  d}t j|	|  |r$|
rtj| | n
tj|  W d|r8|j  n|rHt j| |	rxt jj|	rxyt j|	 W n   Y nX X dS )zSafely overwrite a file by creating a temporary file in the same
    directory, writing it, moving it over the original file, eventually
    preserving file mode, SELinux context and ownership.Nr   F)r   r   zgetfilecon(%r) failedw)r	   r   realpathr   r   existsr:   r;   r   Zmkstempr    r
   fchownst_uidst_gidr0   r2   r3   Z
getfileconrA   fdopenr6   r7   r$   Z
setfileconr<   isfiler8   )r   ZcontentZpreserve_moderG   Zpreserve_ownershipZdir_basefdfZtmpnamerM   r?   rI   rH   r   r   r   r      sR    



)TT)TT)FT)TTT)__doc__Z
__future__r   r   __builtins__r   r   __all__r	   r:   r   r"   r
   r5   r   r   r   r   r   rJ   r   r   r   r   r   <module>   s&   !
5

? 