a
    
d                     @   sN   d dl Z d dlmZ dd Zdd Zdd Zdd	d
ZdddZdddZ	dS )    N)versionc                 C   sL   t | ts| f} tj| k rHddlm} td| ddd | D d S )Nr   )python_versiona   

You are running scikit-image on an unsupported version of Python.

Unfortunately, scikit-image 0.15 and above no longer work with your installed
version of Python ({}).  You therefore have two options: either upgrade to
Python {}, or install an older version of scikit-image.

For Python 2.7 or Python 3.4, use

 $ pip install 'scikit-image<0.15'

Please also consider updating `pip` and `setuptools`:

 $ pip install pip setuptools --upgrade

Newer versions of these tools avoid installing packages incompatible
with your version of Python.
.c                 S   s   g | ]}t |qS  )str).0vr   r   m/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/skimage/_shared/version_requirements.py
<listcomp>        z)ensure_python_version.<locals>.<listcomp>)	
isinstancetuplesysversion_infoplatformr   ImportErrorformatjoin)min_versionr   r   r   r	   ensure_python_version   s    

r   c                 C   s   z|dkr t | t |kW S |dkr>t | t |kW S |dkr\t | t |kW S |dkrzt | t |k W S W dS W n ty   Y dS 0 dS )a)  
    Check version string of an active module against a required version.

    If dev/prerelease tags result in TypeError for string-number comparison,
    it is assumed that the dependency is satisfied.
    Users on dev branches are responsible for keeping their own packages up to
    date.
    >>==<FTN)_versionparse	TypeError)actverr   cmp_opr   r   r	   _check_version#   s    	
r   c                 C   s,   t | | dd gd}t|dt|ddS )z<Return module version or None if version can't be retrieved.r   fromlist__version__VERSIONN)
__import__
rpartitiongetattr)module_namemodr   r   r	   get_module_version;   s    r*   c                 C   s   |   dkrtjdd }n"zt| }W n ty<   Y dS 0 |du rJdS ddl}|d|}|dusnJ d|d|  }|sd	}|d
v sJ d| d|| d }t|||S dS )a  Test if *name* is installed.

    Parameters
    ----------
    name : str
        Name of module or "python"
    version : str, optional
        Version string to test against.
        If version is not None, checking version
        (must have an attribute named '__version__' or 'VERSION')
        Version may start with =, >=, > or < to specify the exact requirement

    Returns
    -------
    out : bool
        True if `name` is installed matching the optional version.
    pythonN   FTr   z[0-9]zInvalid version numberr   )r   r   r   r   zInvalid version condition '')	lowerr   r   r*   r   researchstartr   )namer   r   r/   matchZsymbr   r   r	   is_installedB   s&    

r4   c                    s   ddl   fdd}|S )a@  Return decorator that forces a requirement for a function or class.

    Parameters
    ----------
    name : str
        Name of module or "python".
    version : str, optional
        Version string to test against.
        If version is not None, checking version
        (must have an attribute named '__version__' or 'VERSION')
        Version may start with =, >=, > or < to specify the exact requirement

    Returns
    -------
    func : function
        A decorator that raises an ImportError if a function is run
        in the absence of the input dependency.
    r   Nc                    s      fdd}|S )Nc                     sV   t  r| i |S d dj d  }d urF|d 7 }t|d d S )N"z" in "z" requires " )r4   
__module__r   )argskwargsmsg)r2   objr   r   r	   func_wrapped   s    
z0require.<locals>.decorator.<locals>.func_wrapped)wraps)r;   r<   	functoolsr2   r   )r;   r	   	decorator   s    zrequire.<locals>.decorator)r?   )r2   r   r@   r   r>   r	   requirem   s    rA   c                 C   s&   t | |sdS t| | dd gdS )a)  Return a module object of name *module_name* if installed.

    Parameters
    ----------
    module_name : str
        Name of module.
    version : str, optional
        Version string to test against.
        If version is not None, checking version
        (must have an attribute named '__version__' or 'VERSION')
        Version may start with =, >=, > or < to specify the exact requirement

    Returns
    -------
    mod : module or None
        Module if *module_name* is installed matching the optional version
        or None otherwise.
    Nr   r    r!   )r4   r%   r&   )r(   r   r   r   r	   
get_module   s
    
rB   )N)N)N)
r   	packagingr   r   r   r   r*   r4   rA   rB   r   r   r   r	   <module>   s   
+
%