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