
    gg                     <    d Z ddlZddlmZmZ ddlmZ dgZ	 ddZy)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_safec           
      r   	 t         j                  j                  | |      ry	 |s3t        j                  |t         j
                        rt        d| d      	 t        j                  | |       y# t        $ r Y Xw xY w# 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                  |t        j                         d}|dk7  r-|j!                  |      }t        j"                  ||       |dk7  r-t        j$                  |       t        j&                  |       n/# t        j$                  |       t        j&                  |       w xY w	 ddd       n# 1 sw Y   nxY w	 t)        | |       n,# t*        $ r  	 t-        | |       n# t*        $ r Y nw xY wY nw xY w	 t        j.                  |        y# t*        $ r}t        |dd      d	k7  r Y d}~y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_EXCLr   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/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/core/files/move.pyr   r      s   77M=9 :
 ryy@.ST
 	

		-/     	 
mT	"hWW**"j!,- %4299<
	JJr5==) M3& (j 9]+  3& LLHHRL LLHHRLL' 
#	"	"*
. 
	]M2 		
		-  
 1j!$* +s    A1 B  1	A=<A= 	BBAF59AE<+F5<,F((F55F>G 	G8G&%G8&	G2/G81G22G87G8<H 	H6H11H6)i   F)	__doc__r   shutilr   r   django.core.filesr   __all__r    r
   r*   <module>r0      s*    
 % #
 INJr
   