
    	i                     >    d Z ddlZddlmZmZ ddlmZ dgZ	 d	dZdS )
z
Move a file in the safest way possible::

    >>> from django.core.files.move import file_move_safe
    >>> file_move_safe("/tmp/old_file", "/tmp/new_file")
    N)copymodecopystat)locksfile_move_safe   Fc           
         	 t           j                            | |          rdS n# t          $ r Y nw xY w|s2t          j        |t           j                  rt          d| d          	 t          j        | |           dS # t          $ r Y nw xY wt          | d          5 }t          j        |t           j	        t           j
        z  t          t           dd          z  |st           j        ndz  t           j        z            }	 t          j        |t          j                   d}|dk    r0|                    |          }t          j        ||           |dk    0t          j        |           t          j        |           n-# t          j        |           t          j        |           w xY w	 ddd           n# 1 swxY w Y   	 t+          | |           n2# t,          $ r% 	 t/          | |           n# t,          $ r Y nw xY wY nw xY w	 t          j        |            dS # t,          $ r!}t          |dd          d	k    r Y d}~dS d}~ww xY w)
aU  
    Move a file from one location to another in the safest way possible.

    First, try ``os.rename``, which is simple but will break across filesystems.
    If that fails, stream manually from one file to another in pure Python.

    If the destination file exists and ``allow_overwrite`` is ``False``, raise
    ``FileExistsError``.
    NzDestination file z% exists and allow_overwrite is False.rbO_BINARYr       winerror    )ospathsamefileOSErroraccessF_OKFileExistsErrorrenameopenO_WRONLYO_CREATgetattrO_EXCLO_TRUNCr   lockLOCK_EXreadwriteunlockcloser   PermissionErrorr   remove)old_file_namenew_file_name
chunk_sizeallow_overwriteold_filefdcurrent_chunkes           N/srv/django_bis/venv311/lib/python3.11/site-packages/django/core/files/move.pyr   r      s   7M=99 	F	     
ry@@ 
TTTT
 
 	

	-///    	 
mT	"	" hW*"j!,,- %4:299< *		
 	
	Jr5=))) M3&& (j 9 9]+++  3&& LHRLLLL LHRLLLLL)              ,
....   
	]M2222 	 	 	D	
	-        
 1j!$$** +*****s    % 
22*B 
BB!A"F>AF)F>*F..F>>GG
G 
H
&G76H
7
HH
HH
	H
H$ $
I.I

I)r   F)	__doc__r   shutilr   r   django.core.filesr   __all__r    r   r,   <module>r2      sw     
			 % % % % % % % % # # # # # #
 INK K K K K Kr   