OwlCyberSecurity - MANAGER
Edit File: temp.cpython-39.pyc
a kH�f� � @ sT d Z ddlZddlZddlmZ dZejdkrDG dd� 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@ e Zd ZdZddd�ZejZdd � Zd d� Zdd � 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���� Nc C s4 t j|||d�\}}|| _t�|||�| _d| _d S )N)�suffix�prefix�dirF)�tempfile�mkstemp�name�os�fdopen�file�close_called)�self�mode�bufsizer r r �fdr � r �X/home/gouroczh/virtualenv/test/3.9/lib/python3.9/site-packages/django/core/files/temp.py�__init__* s zTemporaryFile.__init__c C sV | j sRd| _ z| j�� W n ty, Y n0 z| �| j� W n tyP Y n0 d S )NT)r r �close�OSError�unlinkr �r r r r r 5 s zTemporaryFile.closec C s | � � d S �N)r r r r r �__del__A s zTemporaryFile.__del__c C s | j �� | S r )r � __enter__r r r r r! D s zTemporaryFile.__enter__c C s | j �|||� d S r )r �__exit__)r �exc�value�tbr r r r"