U
    f/e                     @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ dddddd	d
ddddddddddddddddddZdddddddd Z	d!d"d#d$d%Z
d,d"d"d"d(d)d*d+ZdS )-    )annotationsN)Versionz4.6.0z1.2.1z0.7.4z0.4.0z0.6.0z4.3.0z2.2.3z2.7.0z1.3.0z3.0.0z0.12.0z0.17.0z6.0z1.0.6z1.2.0z3.5.1z0.8.7z0.12.3z1.0.2z0.46.0)bs4
bottleneckZfsspecZfastparquetZgcsfs
lxml.etreeZ
matplotlibZnumexprodfpyZopenpyxl
pandas_gbqZpyarrowZpytestZpyxlsbZs3fsZscipy
sqlalchemyZtablesZtabulateZxarrayZxlrdZxlwtZ
xlsxwriterZnumbaZbeautifulsoup4Z
Bottlenecklxmlr   z
pandas-gbqZ
SQLAlchemyZJinja2)r   r   r   Zodfr   r	   Zjinja2ztypes.ModuleTypestr)modulereturnc                 C  s<   t | dd }|d kr t | dd }|d kr8td| j |S )N__version__Z__VERSION__zCan't determine version for )getattrImportError__name__)r   version r   ;/tmp/pip-unpacked-wheel-tiezk1ph/pandas/compat/_optional.pyget_version5   s    r    raisez
str | None)nameextraerrorsmin_versionc                 C  s$  |dkst t| }|dk	r"|n| }d| d| d| d}zt| }W n. tk
rz   |dkrpt|dnY dS Y nX | dd }|| kr|}tj| }	n|}	|dk	r|nt	|}
|
r t
|	}t|t|
k r d	|
 d
| d| d}|dkrt|t dS |dkr t||S )a9  
    Import an optional dependency.

    By default, if a dependency is missing an ImportError with a nice
    message will be raised. If a dependency is present, but too old,
    we raise.

    Parameters
    ----------
    name : str
        The module name.
    extra : str
        Additional text to include in the ImportError message.
    errors : str {'raise', 'warn', 'ignore'}
        What to do when a dependency is not found or its version is too old.

        * raise : Raise an ImportError
        * warn : Only applicable when a module's version is to old.
          Warns that the version is too old and returns None
        * ignore: If the module is not installed, return None, otherwise,
          return the module, even if the version is too old.
          It's expected that users validate the version locally when
          using ``errors="ignore"`` (see. ``io/html.py``)
    min_version : str, default None
        Specify a minimum version that is different from the global pandas
        minimum version required.
    Returns
    -------
    maybe_module : Optional[ModuleType]
        The imported module, when found and the version is correct.
        None is returned when the package is not found and `errors`
        is False, or when the package's version is too old and `errors`
        is ``'warn'``.
    >   ignorewarnr   NzMissing optional dependency 'z'. z Use pip or conda to install .r   r   zPandas requires version 'z' or newer of 'z' (version 'z' currently installed).r   )AssertionErrorINSTALL_MAPPINGget	importlibimport_moduler   splitsysmodulesVERSIONSr   r   warningsr   UserWarning)r   r   r   r   package_nameZinstall_namemsgr   parentZmodule_to_getminimum_versionr   r   r   r   import_optional_dependency@   s8    )


r.   )r   r   N)
__future__r   r"   r%   typesr(   Zpandas.util.versionr   r'   r    r   r.   r   r   r   r   <module>   sV      