????
Your IP : 3.142.201.19
�
�5oJs�����dZgd�ZddlZddlZddlZddlZ ddl
ZddlZ
ddlmZddlZddlZddlZddlZej0Ze j4e j6ze j8zZee d�ree j>zZeZ ee d�re e jBzZ ee d�r
e jDZ"ndZ"d Z#e�Z$d
�Z%d�Z&d�Z'Gd
�d�Z(d�Z)d�Z*da+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1da2d�Z3d�Z4d�Z5d.d�Z6d/d�Z7de#dfd�Z8Gd�d�Z9Gd �d!�Z: d0dd"d#�d$�Z;e jxd%k7sejzd&k(re;Z>nee d'�a? d1dd(�d)�Z>Gd*�d+ej��ZAGd,�d-�ZBy)2a�Temporary files.
This module provides generic, low- and high-level interfaces for
creating temporary files and directories. All of the interfaces
provided by this module can be used without fear of race conditions
except for 'mktemp'. 'mktemp' is subject to race conditions and
should not be used; it is provided for backward compatibility only.
The default path names are returned as str. If you supply bytes as
input, all return values will be in bytes. Ex:
>>> tempfile.mkstemp()
(4, '/tmp/tmptpu9nin8')
>>> tempfile.mkdtemp(suffix=b'')
b'/tmp/tmppbi8f0hy'
This module also provides some data items to the user:
TMP_MAX - maximum number of names that will be tried before
giving up.
tempdir - If this is set to a string before the first use of
any routine from this module, it will be considered as
another candidate location to store temporary files.
)
�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYr i'�tmpc�N� tj|�y#t$rYywxYw)NTF)�_os�lstat�OSError)�fns �//opt/alt/python312/lib64/python3.12/tempfile.py�_existsrLs+���� � �"�
���������� $�$c�R�d}|D]w}|��t|tj�rtj|�}t|t�r|t
urt
d��t}�_|turt
d��t
}�y|�&t�ttt
�rt
StS|S)zBLook at the type of all args and divine their implied return type.Nz1Can't mix bytes and non-bytes in path components.)�
isinstancer�PathLike�fspath�bytes�str� TypeErrorr)�args�return_type�args r�_infer_return_typer&Us����K����;���c�3�<�<�(��*�*�S�/�C��c�5�!��c�!��!3�4�4��K��e�#��!3�4�4��K�!�"���?�j��#�6��J��L���c���t|||�}|�|�}|�(|turt}ntjt�}|�|turt�}n
t
�}||||fS)z9Common parameter processing for most APIs in this module.)r&r!�templater�fsencoderr)�prefix�suffix�dir�output_types r�_sanitize_paramsr/rsf��$�V�V�S�9�K�
�~����
�~��#���F��\�\�(�+�F�
�{��#���,�C��-�C��6�3��+�+r'c�0�eZdZdZdZed��Zd�Zd�Zy)�_RandomNameSequencea,An instance of _RandomNameSequence generates an endless
sequence of unpredictable strings which can safely be incorporated
into file names. Each string is eight characters long. Multiple
threads can safely use the same instance at the same time.
_RandomNameSequence is an iterator.�%abcdefghijklmnopqrstuvwxyz0123456789_c��tj�}|t|dd�k7rt�|_||_|jS)N�_rng_pid)r�getpid�getattr�_Random�_rngr4)�self�cur_pids r�rngz_RandomNameSequence.rng�s8���*�*�,���g�d�J��5�5�� �D�I�#�D�M��y�y�r'c��|S�N��r9s r�__iter__z_RandomNameSequence.__iter__�s���r'c�n�dj|jj|jd���S)N��)�k)�joinr;�choices�
charactersr?s r�__next__z_RandomNameSequence.__next__�s)���w�w�t�x�x�'�'����1�'�=�>�>r'N) �__name__�
__module__�__qualname__�__doc__rG�propertyr;r@rHr>r'rr1r1�s*��+�9�J�
�����?r'r1c��g}dD]+}tj|�}|s�|j|��-tjdk(rR|j tj
j
d�tj
jd�ddddg�n|j gd �� |jtj��|S#ttf$r#|jtj�Y|SwxYw)
z[Generate a list of candidate temporary directories which
_get_default_tempdir will try.)�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmp)z/tmpz/var/tmpz/usr/tmp)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlist�envname�dirnames r�_candidate_tempdir_listr`�s����G�+���*�*�W�%���G�N�N�7�+�+�
�x�x�4��������,�,�-D�E����,�,�-A�B�#�Y��'�D� E� ���9�:�#����s�z�z�|�$��N��
�G�$�#����s�z�z�"��N�#�s�,#C�.D�Dc�|�t�}t�}|D]�}|tjk7rtjj|�}t
d�D]�}t|�}tjj||�} tj|td�} tj|d�tj|� tj|�|ccS��t+t,j.d|z��#tj|�wxYw#tj|�wxYw#t$rY��t$r^tj dk(rFtjj#|�r'tj$|tj&�rY��SY���t($rY���wxYw)aqCalculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is deleted. To prevent denial of
service, the name of the test file must be randomized.�d�sblatrRz)No usable temporary directory found in %s)r1r`rr\rW�abspath�range�nextrE�open�_bin_openflags�write�close�unlink�FileExistsError�PermissionErrorrU�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)�namerr]r-�seqrU�filename�fds r�_get_default_tempdirrx�sI��
�!�E�%�'�G����#�*�*���(�(�"�"�3�'�C���:�C���;�D��x�x�}�}�S�$�/�H�
��X�X�h���>��)�&�� � �"�g�.�� � �"�
��J�J�x�(��
�� �8�F�M�M�G�#�$�%�%��� � �"�
���J�J�x�(��"�
��"�
��H�H��$�������)<��J�J�s�C�H�H�-����
��
�sI�D>�#D
�9D$�D>�
D!�!D$�$D;�;D>�> F;� AF;�.F;�:F;c���t�?tj� t�
t�atj �tStS#tj �wxYw)z7Common setup sequence for all user-callable interfaces.)�_name_sequence�
_once_lock�acquirer1�releaser>r'r�_get_candidate_namesr~�sP�������� !��%�!4�!6����� ���>���
��� ���A�A"c��tjj|�}t�}|turttj|�}tt�D]f}t|�}tjj|||z|z�}tjd|� tj||d�} | |fcStt(j*d��#t$rY��t$rZtj dk(rEtjj#|�r&tj$|tj&�rY��wxYw)z>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.ztempfile.mkstemprcrRz#No usable temporary file name found)rrWrdr~r �mapr*rer rfrE�_sys�auditrgrlrmrUrnrorprr�EEXIST)
r-�pre�suf�flagsr.�namesrurU�filerws
r�_mkstemp_innerr��s���(�(�
�
�3�
�C� �"�E��e���C�L�L�%�(���W�~���E�{���x�x�}�}�S�#��*�s�"2�3���
�
�%�t�,� ����$��u�-�B��4�x��!�$�&�-�-�?�A�A��� ��� ����D� �S�X�X�^�^�C�%8��
�
�3����)��� �s�&C� E�)AE� Ec��|tjvr
||g|��ddi�ytjdk(stjj |�s
||g|���yy)N�follow_symlinksFrR)r�supports_follow_symlinksrUrW�islink)�funcrWr#s r�_dont_follow_symlinksr�sO���s�+�+�+��T�0�D�0�%�0� ���T� �������!6��T��D��"7r'c�� tj}t||d�ttj|d�y#t$rY�'wxYw)Nr�)r�chflagsr�r[�chmod)rWr�s r�_resetpermsr�sB��0��+�+�� �g�t�Q�/��#�)�)�T�5�1�� �
��
�s�;� A�Ac�4�tjt�S)z7The default prefix for temporary directories as string.)r�fsdecoder)r>r'rr
r
#����<�<��!�!r'c�4�tjt�S)z6The default prefix for temporary directories as bytes.)rr*r)r>r'rr
r
'r�r'c���t�?tj� t�
t�atj �tStS#tj �wxYw)z&Private accessor for tempfile.tempdir.)rr{r|rxr}r>r'r�_gettempdirr�-sL�������� !���.�0����� ��N�7�N��
��� �rc�<�tjt��S)z Returns tempfile.tempdir as str.)rr�r�r>r'rrr9����<�<��
�&�&r'c�<�tjt��S)z"Returns tempfile.tempdir as bytes.)rr*r�r>r'rrr=r�r'c�b�t|||�\}}}}|rt}nt}t|||||�S)a�User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
If 'suffix' is not None, the file name will end with that suffix,
otherwise there will be no suffix.
If 'prefix' is not None, the file name will begin with that prefix,
otherwise a default prefix is used.
If 'dir' is not None, the file will be created in that directory,
otherwise a default directory is used.
If 'text' is specified and true, the file is opened in text
mode. Else (the default) the file is opened in binary mode.
If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
same type. If they are bytes, the returned name will be bytes; str
otherwise.
The file is readable and writable only by the creating user ID.
If the operating system uses permission bits to indicate whether a
file is executable, the file is executable by no one. The file
descriptor is not inherited by children of this process.
Caller is responsible for deleting the file when done with it.
)r/�_text_openflagsrhr�)r,r+r-�textr.r�s rrrAs;��:(8����'L�$�F�F�C��������#�v�v�u�k�B�Br'c��t|||�\}}}}t�}|turttj
|�}t
t�D]�}t|�}tjj|||z|z�}tjd|� t j|d�tjj)|�cStt*j,d��#t$rY��t$r[tj dk(rFtjj#|�r't j$|tj&�rY�� �wxYw)aUser-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is responsible for deleting the directory when done with it.
ztempfile.mkdtempr�rRz(No usable temporary directory name found)r/r~r r�rr*rer rfrWrEr�r��mkdirrlrmrUrnrorprdrrr�)r,r+r-r.r�rurUr�s rrrhs��(8����'L�$�F�F�C�� �"�E��e���C�L�L�%�(���W�~���E�{���x�x�}�}�S�&�4�-�&�"8�9���
�
�%�t�,� ��I�I�d�E�"��x�x����%�%�!�$�&�-�-�D�F�F��� ��� ����D� �S�X�X�^�^�C�%8��
�
�3����)��� �s�C+�+ E�6AE�ErBc�
�|�
t�}t�}tt�D]B}t |�}t
jj|||z|z�}t|�r�@|cSttjd��)a�User-callable function to return a unique temporary file name. The
file is not created.
Arguments are similar to mkstemp, except that the 'text' argument is
not accepted, and suffix=None, prefix=None and bytes file names are not
supported.
THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED. The file name may
refer to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch.
z"No usable temporary filename found)rr~rer rfrrWrErrlrrr�)r,r+r-r�rurUr�s rrr�sr��$�{��l�� �"�E��W�~���E�{���x�x�}�}�S�&�4�-�&�"8�9���t�}��K� ��&�-�-�>�@�@r'c�f�eZdZdZdZdZd d�Zejdk(ejfd�Z
d�Zd�Zy)
�_TemporaryFileCloserz�A separate object allowing proper closing of a temporary file's
underlying file object, without adding a __del__ method to the
temporary file.Fc�<�||_||_||_||_yr=)r�rU�delete�delete_on_close�r9r�rUr�r�s r�__init__z_TemporaryFileCloser.__init__�s���� ��� ����.��r'rRc��|jsed|_ |js!d|_|jj�|jr#|r|j
s ||j�yyyy#t$rYywxYw#|jr2|r|j
s# ||j�w#t$rYwwxYwwwxYw�NT)�cleanup_called�close_calledr�rjr�r�rUrq)r9�windowsrks r�cleanupz_TemporaryFileCloser.cleanup�s����"�"�"&�D��
��(�(�(,�D�%��I�I�O�O�%��;�;��D�4H�4H���t�y�y�)�5I�;�#��-������;�;��D�4H�4H���t�y�y�)��,�����5I�;�sA�-B�A3�3 A?�>A?�C�B1�0C�1 B=�:C�<B=�=Cc��|jsMd|_ |jj�|jr|jr|j�yyyy#|jr|jr|j�wwwxYwr�)r�r�rjr�r�r�r?s rrjz_TemporaryFileCloser.close�sm��� � � $�D��
#�� � ���!��;�;�4�#7�#7��L�L�N�$8�;�!��
�;�;�4�#7�#7��L�L�N�$8�;�s�A�,Bc�$�|j�yr=)r�r?s r�__del__z_TemporaryFileCloser.__del__�s�����r'N�TT)
rIrJrKrLr�r�r�rrUrkr�rjr�r>r'rr�r��s;����N��L�/� #�x�x�4�/����� #�r'r�c�6�eZdZdZd d�Zd�Zd�Zd�Zd�Zd�Z y)
�_TemporaryFileWrapperz�Temporary file wrapper
This class provides a wrapper around files opened for
temporary use. In particular, it seeks to automatically
remove the file when it is no longer needed.
c�F�||_||_t||||�|_yr=)r�rUr��_closerr�s rr�z_TemporaryFileWrapper.__init__�s%���� ��� �+�D�$��,;�=��r'c����|jd}t||�}t|d�r2|�tj���fd��}|j
|_|}t
|t�s
t|||�|S)Nr��__call__c����|i|��Sr=r>)r#�kwargsr�s �r�func_wrapperz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper�s����T�,�V�,�,r') �__dict__r6�hasattr�
_functools�wrapsr�r�int�setattr)r9rUr��ar�r�s @r�__getattr__z!_TemporaryFileWrapper.__getattr__�sy����}�}�V�$���D�$����1�j�!��D�
�
�
�d�
#�
-�$�
-�$(�<�<�L� ��A��!�S�!��D�$��"��r'c�:�|jj�|Sr=)r�� __enter__r?s rr�z_TemporaryFileWrapper.__enter__�s��� � �����r'c�t�|jj|||�}|jj�|Sr=)r��__exit__r�r�)r9�exc�value�tb�results rr�z_TemporaryFileWrapper.__exit__s/�����#�#�C���3���������
r'c�8�|jj�y)zA
Close the temporary file, possibly deleting it.
N)r�rjr?s rrjz_TemporaryFileWrapper.close s��
�����r'c#�6K�|jD]}|���y�wr=)r�)r9�lines rr@z_TemporaryFileWrapper.__iter__s�����I�I�D��J��s�Nr�)
rIrJrKrLr�r�r�r�rjr@r>r'rr�r��s%���=��*��
�r'r�T)�errorsr�c �
����
���t����\����t�
tjdk(r|r| r�
tjz�
d|vrtj|�}d���
����fd�}
tj�||||||
��} t|d|�}t|d|�}�|_t|�|| �S#|j��xYw#��,tjdk(r|r| stj���xYw)a�Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to io.open (default "w+b").
'buffering' -- the buffer size argument to io.open (default -1).
'encoding' -- the encoding argument to io.open (default None)
'newline' -- the newline argument to io.open (default None)
'delete' -- whether the file is automatically deleted (default True).
'delete_on_close' -- if 'delete', whether the file is deleted on close
(default True) or otherwise either on context manager exit
(if context manager was used) or on object finalization. .
'errors' -- the errors argument to io.open (default None)
The file is created as mkstemp() would do it.
Returns an object with a file-like interface; the name of the file
is accessible as its 'name' attribute. The file will be automatically
deleted when it is closed unless the 'delete' argument is set to False.
On POSIX, NamedTemporaryFiles cannot be automatically deleted if
the creating process is terminated abruptly with a SIGKILL signal.
Windows can delete the file even in this case.
rR�bNc�,��t������\}�|Sr=)r�)r#rwr-r�rUr.r+r,s ������r�openerz"NamedTemporaryFile.<locals>.openerAs���!�#�v�v�u�k�J���D�� r'�� buffering�newline�encodingr�r��buffer�raw)r/rhrrU�O_TEMPORARY�_io�
text_encodingrgr6r�rjrk)�moder�r�r�r,r+r-r�r�r�r�r�r�r�rUr.s ``` @@@rrrs���6(8����'L�$�F�F�C���E��x�x�4��F��
���� ��
�$���$�$�X�.���D�����x�x��T�Y� '�(�6�%�'�� ��$��$�/�C��#�u�c�*�C��C�H�(��t�V�_�M�M�� ��J�J�L�������H�H����O��J�J�t��
�s�/C�.B;�;C�C�1D�posix�cygwin� O_TMPFILE�r�c ��������
�d|vrtj|�}t����\����
t�trId����fd�} tj
�||||||��} t
| d| �}
t
|
d|
�}
�|
_| Sd�����
��fd�}tj
�||||||��} t
| d| �}
t
|
d|
�}
�|
_| S#t$rdaY�Xt$rY�bwxYw) a�Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to io.open (default "w+b").
'buffering' -- the buffer size argument to io.open (default -1).
'encoding' -- the encoding argument to io.open (default None)
'newline' -- the newline argument to io.open (default None)
'errors' -- the errors argument to io.open (default None)
The file is created as mkstemp() would do it.
Returns an object with a file-like interface. The file has no
name, and will cease to exist when it is closed.
r�Nc����tjztjz}tj�|d���S)Nrc)rr��O_CREATrg)r#�flags2r-rwr�s ���rr�zTemporaryFile.<locals>.opener|s3����#�-�-�/�C�K�K�<�?���X�X�c�6�5�1��� r'r�r�r�Fc���t������\�} tj|��S#t$r}tj���d}~wwxYwr=)r�rrk�
BaseExceptionrj) r#rU�er-rwr�r.r+r,s ������rr�zTemporaryFile.<locals>.opener�sQ���%�c�6�6�5�+�N�H�B��
��
�
�4� ��I��!�
�� � �"�
���
�s�,� A�A�A)
r�r�r/rh�_O_TMPFILE_WORKSrgr6rU�IsADirectoryErrorr)r�r�r�r�r,r+r-r�r�r�r�rwr�r.s ``` @@@rrrbs���$�d�?��(�(��2�H�+;�F�F�C�+P�(����[�����B�
�
��x�x��T�Y�(/�(�'-�f�>���d�H�d�3���c�5�#�.�������&�� � ��x�x��T�Y� '�(�6�%�'���d�H�d�+���c�5�#�&��������E%�
)�$)� ��
��
�s�>C�C*�C*�)C*c�D�eZdZdZdZ d%dd�d�Zeej�Z d�Z
d�Zd�Zd �Z
d
�Zd�Zd�Zed
��Zed��Zed��Zd�Zd�Zd�Zed��Zed��Zed��Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d&d �Z%d!�Z&d"�Z'd#�Z(d$�Z)y)'rz�Temporary file wrapper, specialized to switch from BytesIO
or StringIO to a real file when it exceeds a certain size or
when a fileno is needed.
FNr�c ��d|vrtj�|_nEtj|�}tjtj�|| |��|_||_d|_|||||||| d�|_y)Nr�)r�r�r�F)r�r�r,r+r�r�r-r�)r��BytesIO�_filer��
TextIOWrapper� _max_size�_rolled�_TemporaryFileArgs)
r9�max_sizer�r�r�r�r,r+r-r�s
rr�zSpooledTemporaryFile.__init__�sy���$�;�����D�J��(�(��2�H��*�*�3�;�;�=�%-�f�$+�-�D�J�"������+/�i�-3�v�/7�G�*-��#A��r'c��|jry|j}|r%|j�|kDr|j�yyyr=)r�r��tell�rollover)r9r�r�s r�_checkzSpooledTemporaryFile._check�s4���<�<���>�>���� � ��h�.��M�M�O�/�8r'c��|jry|j}tdi|j��x}|_|`|j �}t|d�r8|jj|j�j��n|j|j��|j|d�d|_y)Nr�rTr>)r�r�rr�r�r�r�ri�detach�getvalue�seek)r9r��newfile�poss rr�zSpooledTemporaryFile.rollover�s����<�<���z�z��,�G�t�/F�/F�G�G��$�*��#��i�i�k���7�H�%��N�N� � �����!7�!7�!9�:��M�M�$�-�-�/�*����S�!����r'c�H�|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueErrorr?s rr�zSpooledTemporaryFile.__enter__�s ���:�:����D�E�E��r'c�8�|jj�yr=�r�rj�r9r�r�r�s rr�zSpooledTemporaryFile.__exit__�����
�
���r'c�6�|jj�Sr=)r�r@r?s rr@zSpooledTemporaryFile.__iter__�����z�z�"�"�$�$r'c��|js=tjdj|�td|��|j�yy)NzUnclosed file {!r}�)�
stacklevel�source)r� _warnings�warn�format�ResourceWarningrjr?s rr�zSpooledTemporaryFile.__del__�s<���{�{��N�N�$�+�+�D�1����
�
�J�J�L�r'c�8�|jj�yr=rr?s rrjzSpooledTemporaryFile.close�rr'c�.�|jjSr=)r�rr?s rrzSpooledTemporaryFile.closed�����z�z� � � r'c�.�|jjSr=)r�r�r?s rr�zSpooledTemporaryFile.encoding�����z�z�"�"�"r'c�.�|jjSr=)r�r�r?s rr�zSpooledTemporaryFile.errorsrr'c�V�|j�|jj�Sr=)r�r��filenor?s rrzSpooledTemporaryFile.filenos���
�
���z�z� � �"�"r'c�8�|jj�yr=)r��flushr?s rrzSpooledTemporaryFile.flushrr'c�6�|jj�Sr=)r��isattyr?s rrzSpooledTemporaryFile.isatty����z�z� � �"�"r'c�l� |jjS#t$r|jdcYSwxYw)Nr�)r�r�r[r�r?s rr�zSpooledTemporaryFile.modes5�� 3��:�:�?�?�"��� 3��*�*�6�2�2� 3�s��3�3c�N� |jjS#t$rYywxYwr=)r�rUr[r?s rrUzSpooledTemporaryFile.names'�� ��:�:�?�?�"��� �� �rc�.�|jjSr=)r��newlinesr?s rr"zSpooledTemporaryFile.newlinesrr'c�6�|jj�Sr=)r��readabler?s rr$zSpooledTemporaryFile.readable#r r'c�4�|jj|�Sr=)r��read�r9r#s rr&zSpooledTemporaryFile.read&����t�z�z����%�%r'c�4�|jj|�Sr=)r��read1r's rr*zSpooledTemporaryFile.read1)s���t�z�z����&�&r'c�8�|jj|�Sr=)r��readinto�r9r�s rr,zSpooledTemporaryFile.readinto,s���z�z�"�"�1�%�%r'c�8�|jj|�Sr=)r�� readinto1r-s rr/zSpooledTemporaryFile.readinto1/s���z�z�#�#�A�&�&r'c�4�|jj|�Sr=)r��readliner's rr1zSpooledTemporaryFile.readline2s��"�t�z�z�"�"�D�)�)r'c�4�|jj|�Sr=)r�� readlinesr's rr3zSpooledTemporaryFile.readlines5s��#�t�z�z�#�#�T�*�*r'c�6�|jj�Sr=)r��seekabler?s rr5zSpooledTemporaryFile.seekable8r r'c�4�|jj|�Sr=)r�r�r's rr�zSpooledTemporaryFile.seek;r(r'c�6�|jj�Sr=)r�r�r?s rr�zSpooledTemporaryFile.tell>s���z�z��� � r'c��|�|jj�S||jkDr|j�|jj|�Sr=)r��truncater�r�)r9�sizes rr9zSpooledTemporaryFile.truncateAsD���<��:�:�&�&�(�(��d�n�n�$��
�
���:�:�&�&�t�,�,r'c�6�|jj�Sr=)r��writabler?s rr<zSpooledTemporaryFile.writableIr r'c�b�|j}|j|�}|j|�|Sr=)r�rir�)r9�sr��rvs rrizSpooledTemporaryFile.writeLs)���z�z��
�Z�Z��]�����D��� r'c�b�|j}|j|�}|j|�|Sr=)r��
writelinesr�)r9�iterabler�r?s rrAzSpooledTemporaryFile.writelinesRs*���z�z��
�_�_�X�
&�����D��� r'c�6�|jj�Sr=)r�r�r?s rr�zSpooledTemporaryFile.detachXrr')r�w+b���NNNNNr=)*rIrJrKrLr�r��classmethod�_types�GenericAlias�__class_getitem__r�r�r�r�r@r�rjrMrr�r�rrrr�rUr"r$r&r*r,r/r1r3r5r�r�r9r<rirAr�r>r'rrr�s.����G�9;�(,�/3�A�?C�A�"$�F�$7�$7�8���
�*�
�%����!��!��#��#��!��!�#��#��3��3������#��#�%�&�'�&�'�*�+�%�&�!�-�%���#r'rc��eZdZdZ ddd�d�Zed
d��Zedd��Zd�Zd �Z d
�Z
d�Zeej�Zy)raCreate and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, the directory and everything contained
in it are removed (unless delete=False is passed or an exception
is raised during cleanup and ignore_cleanup_errors is not True).
Optional Arguments:
suffix - A str suffix for the directory name. (see mkdtemp)
prefix - A str prefix for the directory name. (see mkdtemp)
dir - A directory to create this temp dir in. (see mkdtemp)
ignore_cleanup_errors - False; ignore exceptions during cleanup?
delete - True; whether the directory is automatically deleted.
NT)r�c���t|||�|_||_||_t j
||j|jdj|�|j|j��|_y)NzImplicitly cleaning up {!r})�warn_message�
ignore_errorsr�) rrU�_ignore_cleanup_errors�_delete�_weakref�finalize�_cleanupr�
_finalizer)r9r,r+r-�ignore_cleanup_errorsr�s rr�zTemporaryDirectory.__init__ps`���F�F�C�0�� �&;��#����"�+�+��$�-�-����6�=�=�d�C��5�5�d�l�l�L��r'c�J���������fd�}tj�|��y)Nc�2��t|t�r]�r |�k(r�ry� |�k7r(ttjj|��t|� tj|�yyyt|t�ry�s�y#t$r�j|���Y�4t$r]tjj|�rtjj|�r�rYy��j|�|�k(��Y��wxYw#t$rYywxYw)N�rM)rM�repeated)rrmr�rrWr_rkr��_rmtreern�
isjunctionrq)r�rWr��clsrMrUrXs ����r�onexcz)TemporaryDirectory._rmtree.<locals>.onexc|s����#��/�����$�����t�|�#�C�H�H�$4�$4�T�$:�;���%�=��
�
�4�(�=�G�"�C�!2�3��$��%��+-�G����D�
��F�*�
=� #�x�x�~�~�d�3�s�x�x�7J�7J�4�7P�,� &�!����D�
�.2�d�l�$�=�
=��)����sH�8D
�B�D� D
�"AD�*D
�,D�D
�D�D
�
D�D)r\)�_shutil�rmtree)r[rUrMrXr\s```` rrYzTemporaryDirectory._rmtreezs���$ �L ���t�5�)r'c�d�|r.|j||��tj|t�yy�NrW)rYrrr)r[rUrLrMr�s rrRzTemporaryDirectory._cleanup�s(����K�K��M�K�:��N�N�<��9�r'c�b�dj|jj|j�S)Nz <{} {!r}>)r� __class__rIrUr?s r�__repr__zTemporaryDirectory.__repr__�s#���!�!�$�.�.�"9�"9�4�9�9�E�Er'c��|jSr=)rUr?s rr�zTemporaryDirectory.__enter__�s���y�y�r'c�>�|jr|j�yyr=)rOr�rs rr�zTemporaryDirectory.__exit__�s���<�<��L�L�N�r'c���|jj�s)tjj |j
�r(|j
|j
|j��yyr`)rSr�rrW�existsrUrYrNr?s rr�zTemporaryDirectory.cleanup�sE���?�?�!�!�#�s�x�x���t�y�y�'A��L�L����$�2M�2M�L�N�(Br'�NNNF)FF)FT)rIrJrKrLr�rFrYrRrcr�r�r�rGrHrIr>r'rrr\sp���&6:�',�L�8<�L��'*��'*�R�:��:�
F���O�$�F�$7�$7�8�r'rrh)NNN)rDrENNNNNT)rDrENNNNN)CrL�__all__� functoolsr��warningsr�ior��osr�shutilr]�errnorr�randomrr7�sysr��typesrG�weakrefrP�_thread�
allocate_lock�_allocate_lock�O_RDWRr��O_EXCLr�r�rrhrr r)r{rr&r/r1r`rxrzr~r�r�r�r
r
rr�rrrrrr�r�rrU�platformrr��IOBaserrr>r'r�<module>r{s����2��������$������&�&���*�*�s�{�{�*�S�Z�Z�7��
�3����s�~�~�%�O� ��
�3�
���c�l�l�"�N�
�3� ���k�k�G��G����
�
���:,�$?�?�0�6*%�X���A�:�2�"�"���
�'�'�$C�N&F�P�X�4�@�@(�(�V<�<�|;?�9=�(,�<�8<�'+�<�|�8�8�w��$�-�-�8�3�'�M��s�K�0��9=�8<��I�*.�I�Vl#�3�:�:�l#�^\9�\9r'