§
    fŠtjF	  ã                   óz   — d Z ddlZddlmZ ddlmZ ddlmZ ed„ ¦   «         Zed„ ¦   «         Z	ed	d„¦   «         Z
dS )
z? Contexts for *with* statement providing temporary directories
é    N)Úcontextmanager)Úrmtree)Úmkdtempc               #   óL   K  — t          ¦   «         } | V — t          | ¦  «         dS )aè  Create and return a temporary directory. This has the same
    behavior as mkdtemp but can be used as a context manager.

    Upon exiting the context, the directory and everything contained
    in it are removed.

    Examples
    --------
    >>> import os
    >>> with tempdir() as tmpdir:
    ...     fname = os.path.join(tmpdir, 'example_file.txt')
    ...     with open(fname, 'wt') as fobj:
    ...         _ = fobj.write('a string\n')
    >>> os.path.exists(tmpdir)
    False
    N)r   r   )Úds    úQ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/_lib/_tmpdirs.pyÚtempdirr	   	   s)   è è € õ$ 	‰	Œ	€AØ
€G€G€GÝ
ˆ1�I„I€I€I€Ió    c               #   óÂ   K  — t          j        ¦   «         } t          ¦   «         }t          j        |¦  «         |V — t          j        | ¦  «         t	          |¦  «         dS )a®   Create, return, and change directory to a temporary directory

    Examples
    --------
    >>> import os
    >>> my_cwd = os.getcwd()
    >>> with in_tempdir() as tmpdir:
    ...     _ = open('test.txt', 'wt').write('some text')
    ...     assert os.path.isfile('test.txt')
    ...     assert os.path.isfile(os.path.join(tmpdir, 'test.txt'))
    >>> os.path.exists(tmpdir)
    False
    >>> os.getcwd() == my_cwd
    True
    N)ÚosÚgetcwdr   Úchdirr   )Úpwdr   s     r   Ú
in_tempdirr       sN   è è € õ" Œ)‰+Œ+€CÝ‰	Œ	€AÝ„HˆQ�K„K€KØ
€G€G€GÝ„HˆS�M„M€MÝ
ˆ1�I„I€I€I€Ir
   c              #   ó˜   K  — t          j        ¦   «         }| €|V — dS t          j        | ¦  «         | V — t          j        |¦  «         dS )ag   Change directory to given directory for duration of ``with`` block

    Useful when you want to use `in_tempdir` for the final test, but
    you are still debugging. For example, you may want to do this in the end:

    >>> with in_tempdir() as tmpdir:
    ...     # do something complicated which might break
    ...     pass

    But, indeed, the complicated thing does break, and meanwhile, the
    ``in_tempdir`` context manager wiped out the directory with the
    temporary files that you wanted for debugging. So, while debugging, you
    replace with something like:

    >>> with in_dir() as tmpdir: # Use working directory by default
    ...     # do something complicated which might break
    ...     pass

    You can then look at the temporary file outputs to debug what is happening,
    fix, and finally replace ``in_dir`` with ``in_tempdir`` again.
    N)r   r   r   )ÚdirÚcwds     r   Úin_dirr   9   sM   è è € õ. Œ)‰+Œ+€CØ
€{Øˆ	ˆ	ˆ	ØˆÝ„HˆS�M„M€MØ
€I€I€IÝ„HˆS�M„M€M€M€Mr
   )N)Ú__doc__r   Ú
contextlibr   Úshutilr   Útempfiler   r	   r   r   © r
   r   ú<module>r      s®   ððð à 	€	€	€	Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð ðð ñ „ðð, ðð ñ „ðð0 ðð ð ñ „ðð ð r
   