
    Ed                     :    d Z ddlZddlZ G d d          Zd ZdS )zN
This module adds context manager for temporary files generated by the tests.
    Nc                       e Zd ZdZ ed          Z ed          Zedd            Zedd            Z	ed             Z
dS )TmpFileManagerzP
    A class to track record of every temporary files created by the tests.
     c                 :    | j                             |           |S N)	tmp_filesaddclsnames     6lib/python3.11/site-packages/sympy/testing/tmpfiles.pytmp_filezTmpFileManager.tmp_file   s    $    c                 :    | j                             |           |S r   )tmp_foldersr	   r
   s     r   
tmp_folderzTmpFileManager.tmp_folder   s    D!!!r   c                 4   | j         rS| j                                         }t          j                            |          rt          j        |           | j         S| j        r6| j                                        }t          j        |           | j        4d S d S r   )	r   popospathisfileremover   shutilrmtree)r   filefolders      r   cleanupzTmpFileManager.cleanup   s    m 	 =$$&&Dw~~d##  	$ m 	  o 	"_((**FM&!!! o 	" 	" 	" 	" 	"r   N)r   )__name__
__module____qualname____doc__setr   r   classmethodr   r   r    r   r   r   r   	   s          BI#b''K   [    [ " " [" " "r   r   c                       fd}|S )zP
    A decorator to help test codes remove temporary files after the tests.
    c                      	                t                                            d S # t                                            w xY wr   )r   r   )	test_funcs   r   wrapper_functionz+cleanup_tmp_files.<locals>.wrapper_function(   sC    	%IKKK""$$$$$N""$$$$s	   
( Ar$   )r'   r(   s   ` r   cleanup_tmp_filesr)   $   s$    % % % % % r   )r!   r   r   r   r)   r$   r   r   <module>r*      sd      				" " " " " " " "6
 
 
 
 
r   