o
    i                     @   s.   d Z ddlZddlZG dd dZdd ZdS )zN
This module adds context manager for temporary files generated by the tests.
    Nc                   @   sH   e Zd ZdZedZedZed
ddZed
ddZ	edd Z
d	S )TmpFileManagerzP
    A class to track record of every temporary files created by the tests.
     c                 C      | j | |S N)	tmp_filesaddclsname r   e/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/sympy/testing/tmpfiles.pytmp_file      zTmpFileManager.tmp_filec                 C   r   r   )tmp_foldersr   r   r   r   r   
tmp_folder   r   zTmpFileManager.tmp_folderc                 C   sT   | j r| j  }tj|rt| | j s| jr(| j }t| | jsd S d S r   )	r   popospathisfileremover   shutilrmtree)r	   filefolderr   r   r   cleanup   s   



zTmpFileManager.cleanupN)r   )__name__
__module____qualname____doc__setr   r   classmethodr   r   r   r   r   r   r   r   	   s    r   c                    s    fdd}|S )zP
    A decorator to help test codes remove temporary files after the tests.
    c                      s    z
   W t   d S t   w r   )r   r   r   	test_funcr   r   wrapper_function(   s   z+cleanup_tmp_files.<locals>.wrapper_functionr   )r"   r#   r   r!   r   cleanup_tmp_files$   s   r$   )r   r   r   r   r$   r   r   r   r   <module>   s
    