HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/core/files/__pycache__/move.cpython-310.pyc
o

�a��@sHdZddlZddlZddlmZddlmZdgZdd�Zdd
d�Z	dS)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)�copystat)�locks�file_move_safecCsZttjd�rztj�||�WStyYdSwtj�tj�|��tj�tj�|��kS)N�samefileF)�hasattr�os�pathr�OSError�normcase�abspath)�src�dst�r�8/usr/lib/python3/dist-packages/django/core/files/move.py�	_samefiles��r�Fc
Cs�t||�rdSz|st�|tj�rtd|��t�||�WdSty(Ynwt|d��S}t�|tjtj	Bt
tdd�B|sBtjndB�}z(t�
|tj�d}|dkrc|�|�}t�||�|dksTWt�|�t�|�nt�|�t�|�wWd�n1s�wYzt||�Wnty�}z
|jtjkr��WYd}~nd}~wwzt�|�WdSty�}zt
|dd�dkrÂWYd}~dSd}~ww)	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� )rr�access�F_OK�FileExistsError�renamer	�open�O_WRONLY�O_CREAT�getattr�O_EXCLr�lock�LOCK_EX�read�write�unlock�closer�PermissionError�errno�EPERM�remove)�
old_file_name�
new_file_name�
chunk_size�allow_overwrite�old_file�fd�
current_chunk�errrrsV
��
��

��������)rF)
�__doc__r'r�shutilr�django.core.filesr�__all__rrrrrr�<module>s