Ë
    bõhiÏ  ã                   óB   — d Z ddlZddlmZmZ ddlmZ dgZd„ 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                 óˆ  — t        t        j                  d«      r!	 t        j                  j                  | |«      S t        j                  j                  t        j                  j                  | «      «      t        j                  j                  t        j                  j                  |«      «      k(  S # t        $ r Y yw xY w)NÚsamefileF)ÚhasattrÚosÚpathr   ÚOSErrorÚnormcaseÚabspath)ÚsrcÚdsts     úL/var/www/alwasay/venv/lib/python3.12/site-packages/django/core/files/move.pyÚ	_samefiler      sŒ   € äŒr�w‰w˜
Ô#ð	Ü—7‘7×#Ñ# C¨Ó-Ð-ô
 �7‰7×ÑœBŸG™GŸO™O¨CÓ0Ó1´R·W±W×5EÑ5EÜ
�‰�‰˜Óó6ñ ð øô	 ò 	Ùð	ús   œB5 Â5	CÃ Cc           
      óH  — t        | |«      ry	 |s2t        j                  |t        j                  «      rt	        d|z  «      ‚t        j
                  | |«       y# 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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``.
    Nz8Destination file %s exists and allow_overwrite is False.ÚrbÚO_BINARYr   ó    Úwinerroré    )r   r
   ÚaccessÚF_OKÚFileExistsErrorÚrenamer   Ú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           r   r   r      sÜ  € ô � Ô.ØðÙ¤2§9¡9¨]¼B¿G¹GÔ#DÜ!ØJØñ óð ô
 	�	‰	�- Ô/ØøÜò ñ 	ðúô 
ˆm˜TÓ	"ð  hä�W‰WØä—‘Ü—*‘*ñäœ"˜j¨!Ó,ñ-ñ %4”2—9’9¸ñ<ô —*‘*ñ	ó	
ˆð	Ü�J‰J�rœ5Ÿ=™=Ô)Ø ˆMØ 3Ò&Ø (§¡¨jÓ 9�Ü—‘˜˜]Ô+ð   3Ó&ô �L‰L˜ÔÜ�H‰H�R�Løô �L‰L˜ÔÜ�H‰H�R�LúˆL÷)÷ ñ úð,
Ü� Õ.øÜò ð
	Ü�] MÕ2øÜò 	Ùð	üðúðÜ
�	‰	�-Õ øÜò ô
 �1�j !Ó$¨Ò*Øô +ûðús†   �A
A Á	A&Á%A&Á5A.F Ã$AE'Ä<+F Å',FÆF Æ F)Æ-F: Æ:	G#ÇGÇG#Ç	GÇG#ÇGÇG#Ç"G#Ç'G= Ç=	H!ÈHÈH!)i   F)
Ú__doc__r
   Úshutilr   r   Údjango.core.filesr   Ú__all__r   r   © r   r   ú<module>r8      s/   ðñó 
ß %å #àÐ
€òð INôIr   