HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-310.pyc
o

@%Nej�@s(ddlmZddlZGdd�de�ZdS)�)�NamedTemporaryFileNc@sBeZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	d
S)�CallbackFileWrappera
    Small wrapper around a fp object which will tee everything read into a
    buffer, and when that file is closed it will execute a callback with the
    contents of that buffer.

    All attributes are proxied to the underlying file object.

    This class uses members with a double underscore (__) leading prefix so as
    not to accidentally shadow an attribute.

    The data is stored in a temporary file until it is all available.  As long
    as the temporary files directory is disk-based (sometimes it's a
    memory-backed-``tmpfs`` on Linux), data will be unloaded to disk if memory
    pressure is high.  For small files the disk usually won't be used at all,
    it'll all be in the filesystem memory cache, so there should be no
    performance impact.
    cCstddd�|_||_||_dS)Nzrb+T)�delete)r�_CallbackFileWrapper__buf�_CallbackFileWrapper__fp�_CallbackFileWrapper__callback)�self�fp�callback�r�F/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/filewrapper.py�__init__s
zCallbackFileWrapper.__init__cCs|�d�}t||�S)Nr)�__getattribute__�getattr)r�namer	rrr�__getattr__!s
	
zCallbackFileWrapper.__getattr__cCsBz|jjduWStyYnwz|jjWSty YdSw)NF)rr	�AttributeError�closed)rrrr�__is_fp_closed-s�
�z"CallbackFileWrapper.__is_fp_closedcCsb|jr'|j��dkr
d}n|j�dd�ttj|j��dtjd��}|�|�d|_|j��dS)Nr�)�access)	rr�tell�seek�
memoryview�mmap�fileno�ACCESS_READ�close)r�resultrrr�_close>s�
zCallbackFileWrapper._closeNcCs0|j�|�}|r|j�|�|��r|��|S�N)r�readr�write�"_CallbackFileWrapper__is_fp_closedr�r�amt�datarrrr!YszCallbackFileWrapper.readcCs@|j�|�}|dkr|dkr|S|j�|�|��r|��|S)N�s
)r�
_safe_readrr"r#rr$rrrr(dszCallbackFileWrapper._safe_readr )
�__name__�
__module__�__qualname__�__doc__r
rr#rr!r(rrrrr	s
r)�tempfilerr�objectrrrrr�<module>s