
    h                     2    S r SSKrSSKr " S S5      rS rg)zN
This module adds context manager for temporary files generated by the tests.
    Nc                   p    \ rS rSrSr\" S5      r\" S5      r\S	S j5       r	\S	S j5       r
\S 5       rSrg)
TmpFileManager	   zH
A class to track record of every temporary files created by the tests.
 c                 <    U R                   R                  U5        U$ N)	tmp_filesaddclsnames     N/var/www/html/shao/venv/lib/python3.13/site-packages/sympy/testing/tmpfiles.pytmp_fileTmpFileManager.tmp_file   s    $    c                 <    U R                   R                  U5        U$ r   )tmp_foldersr
   r   s     r   
tmp_folderTmpFileManager.tmp_folder   s    D!r   c                    U R                   (       ag  U R                   R                  5       n[        R                  R	                  U5      (       a  [        R
                  " U5        U R                   (       a  Mg  U R                  (       aD  U R                  R                  5       n[        R                  " U5        U R                  (       a  MC  g g r   )	r	   popospathisfileremover   shutilrmtree)r   filefolders      r   cleanupTmpFileManager.cleanup   sv    mm==$$&Dww~~d##		$ mmm oo__((*FMM&! ooor    N)r   )__name__
__module____qualname____firstlineno____doc__setr	   r   classmethodr   r   r    __static_attributes__r"   r   r   r   r   	   sU     BIb'K    " "r   r   c                    ^  U 4S jnU$ )zH
A decorator to help test codes remove temporary files after the tests.
c                  p   >  T " 5         [         R                  5         g ! [         R                  5         f = fr   )r   r    )	test_funcs   r   wrapper_function+cleanup_tmp_files.<locals>.wrapper_function(   s&    	%K""$N""$s    5r"   )r-   r.   s   ` r   cleanup_tmp_filesr0   $   s    % r   )r'   r   r   r   r0   r"   r   r   <module>r1      s!     	" "6
r   