o
    \h                     @   sX   d dl Z d dlZddlmZ zd dlZW n ey   dZY nw dddZd	ddZdS )
    N   )method_files_mapc                    s8  |d u rt } d u rtd u rtdtd tj s'td  d d S | d u r:td  d t	  d S t
| ttfsD| g} | D ]S}t|sNJ |j}||vrctd| dt|  || } fd	d
|D }|D ]&}tj|rtdtj|d  d|  t| qrtd| d qrqFd S )NzsMissing optional dependency 'pooch' required for scipy.datasets module. Please use pip or conda to install 'pooch'.z
scipy-datazCache Directory z! doesn't exist. Nothing to clear.zCleaning the cache directory !zDataset method za doesn't exist. Please check if the passed dataset is a subset of the following dataset methods: c                    s   g | ]	}t j |qS  )ospathjoin).0file	cache_dirr   X/home/air/segue/gemini/backup/venv/lib/python3.10/site-packages/scipy/datasets/_utils.py
<listcomp>-   s    z _clear_cache.<locals>.<listcomp>zCleaning the file r   z for dataset zPath )r   platformdirsImportErroruser_cache_dirr   r   existsprintshutilrmtree
isinstancelisttuplecallable__name__
ValueErrorkeyssplitremove)datasetsr   
method_mapdatasetdataset_name
data_filesdata_filepathsdata_filepathr   r   r   _clear_cache   sH   



r&   c                 C   s   t |  dS )ak  
    Cleans the scipy datasets cache directory.

    If a scipy.datasets method or a list/tuple of the same is
    provided, then clear_cache removes all the data files
    associated to the passed dataset method callable(s).

    By default, it removes all the cached data files.

    Parameters
    ----------
    datasets : callable or list/tuple of callable or None

    Examples
    --------
    >>> from scipy import datasets
    >>> ascent_array = datasets.ascent()
    >>> ascent_array.shape
    (512, 512)
    >>> datasets.clear_cache([datasets.ascent])
    Cleaning the file ascent.dat for dataset ascent
    N)r&   )r   r   r   r   clear_cache:   s   r'   )NN)N)r   r   	_registryr   r   r   r&   r'   r   r   r   r   <module>   s    
/