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__/temp.cpython-310.pyc
o

�a�	�@sTdZddlZddlZddlmZdZejdkr"Gdd�de�ZeZnejZej	Z	dS)a6
The temp module provides a NamedTemporaryFile that can be reopened in the same
process on any platform. Most platforms use the standard Python
tempfile.NamedTemporaryFile class, but Windows users are given a custom class.

This is needed because the Python implementation of NamedTemporaryFile uses the
O_TEMPORARY flag under Windows, which prevents the file from being reopened
if the same flag is not provided [1][2]. Note that this does not address the
more general issue of opening a file for writing and reading in multiple
processes in a manner that works across platforms.

The custom version of NamedTemporaryFile doesn't support the same keyword
arguments available in tempfile.NamedTemporaryFile.

1: https://mail.python.org/pipermail/python-list/2005-December/336957.html
2: https://bugs.python.org/issue14243
�N)�FileProxyMixin)�NamedTemporaryFile�
gettempdir�ntc@s@eZdZdZddd�ZejZdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
TemporaryFilea.
        Temporary file object constructor that supports reopening of the
        temporary file in Windows.

        Unlike tempfile.NamedTemporaryFile from the standard library,
        __init__() doesn't support the 'delete', 'buffering', 'encoding', or
        'newline' keyword arguments.
        �w+b����NcCs4tj|||d�\}}||_t�|||�|_d|_dS)N)�suffix�prefix�dirF)�tempfile�mkstemp�name�os�fdopen�file�close_called)�self�mode�bufsizer
rr�fdr�r�8/usr/lib/python3/dist-packages/django/core/files/temp.py�__init__%s
zTemporaryFile.__init__cCsZ|js+d|_z|j��Wn	tyYnwz	|�|j�WdSty*YdSwdS)NT)rr�close�OSError�unlinkr�rrrrr0s���zTemporaryFile.closecCs|��dS�N)rrrrr�__del__<szTemporaryFile.__del__cCs|j��|Sr)r�	__enter__rrrrr!?s
zTemporaryFile.__enter__cCs|j�|||�dSr)r�__exit__)r�exc�value�tbrrrr"CszTemporaryFile.__exit__)rrr	r	N)�__name__�
__module__�__qualname__�__doc__rrrrr r!r"rrrrrs
	r)
r)rr
�django.core.files.utilsr�__all__rrrrrrrr�<module>s
*