o
    Ö­j—  ã                   @   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 |¡r�t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   úR/var/www/html/CropPilot/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    ÿ
/