
    \h                         S r SSKrSSKrSrSrS r\" 5       (       a  SrSr\R                  " S\R                  5      rS r	SSSSSS0 S4S	 jr
g)
z4Tools to assist importing optional external modules.    Nc                  l    SS K n U R                  SS5      nUS;   a  [        U5      $ [        SU-  5      e)Nr   SYMPY_DEBUGFalse)Truer   z&unrecognized value for SYMPY_DEBUG: %s)osgetenvevalRuntimeError)r   	debug_strs     R/var/www/auris/envauris/lib/python3.13/site-packages/sympy/external/importtools.py__sympy_debugr      sB     		-1I%%IC$% & 	&    Tz(\d+ | [a-z]+ | \.)c                     / n[         R                  U 5       H1  nU(       d  M  US:w  d  M   [        U5      nUR	                  U5        M3     [        U5      $ ! [         a     N,f = f)N.)_component_resplitint
ValueErrorappendtuple)vstring
componentsxs      r   version_tupler   !   sh     J  )1cF a  *   s   A
A%$A%__version__ c	                    [         b  [         O
U=(       d    Sn[        b  [        O
U=(       d    SnSSKn	U(       aW  [        R                  U:  aC  U(       a;  U	R                  SU < SSR                  [        [        U5      5      < S3[        S	S
9  g [        U 40 UD6n
UR                  SS5      nU H.  nUS:X  d  M  U
R                  S:X  d  M  [        U S-   U-   5        M0     U(       a  [        X5      nUb  U" U6 n[!        U5      [!        U5      :  a  U(       a{  [#        U[        5      (       a  UnOF[#        U[$        [&        45      (       a   SR                  [        [        U5      5      nO[        U5      nU	R                  U < SU< S3[        S	S
9  gU
$ ! [         a"    U(       a  U	R                  SU -  [        S	S
9   gU a2  nU(       a!  U	R                  U < S[        U5      < S3S	S
9   SnAgSnAff = f)a  
Import and return a module if it is installed.

If the module is not installed, it returns None.

A minimum version for the module can be given as the keyword argument
min_module_version.  This should be comparable against the module version.
By default, module.__version__ is used to get the module version.  To
override this, set the module_version_attr keyword argument.  If the
attribute of the module to get the version should be called (e.g.,
module.version()), then set module_version_attr_call_args to the args such
that module.module_version_attr(*module_version_attr_call_args) returns the
module's version.

If the module version is less than min_module_version using the Python <
comparison, None will be returned, even if the module is installed. You can
use this to keep from importing an incompatible older version of a module.

You can also specify a minimum Python version by using the
min_python_version keyword argument.  This should be comparable against
sys.version_info.

If the keyword argument warn_not_installed is set to True, the function will
emit a UserWarning when the module is not installed.

If the keyword argument warn_old_version is set to True, the function will
emit a UserWarning when the library is installed, but cannot be imported
because of the min_module_version or min_python_version options.

Note that because of the way warnings are handled, a warning will be
emitted for each module only once.  You can change the default warning
behavior by overriding the values of WARN_NOT_INSTALLED and WARN_OLD_VERSION
in sympy.external.importtools.  By default, WARN_NOT_INSTALLED is False and
WARN_OLD_VERSION is True.

This function uses __import__() to import the module.  To pass additional
options to __import__(), use the import_kwargs keyword argument.  For
example, to import a submodule A.B, you must pass a nonempty fromlist option
to __import__.  See the docstring of __import__().

This catches ImportError to determine if the module is not installed.  To
catch additional errors, pass them as a tuple to the catch keyword
argument.

Examples
========

>>> from sympy.external import import_module

>>> numpy = import_module('numpy')

>>> numpy = import_module('numpy', min_python_version=(2, 7),
... warn_old_version=False)

>>> numpy = import_module('numpy', min_module_version='1.5',
... warn_old_version=False) # numpy.__version__ is a string

>>> # gmpy does not have __version__, but it does have gmpy.version()

>>> gmpy = import_module('gmpy', min_module_version='1.14',
... module_version_attr='version', module_version_attr_call_args=(),
... warn_old_version=False)

>>> # To import a submodule, you must pass a nonempty fromlist to
>>> # __import__().  The values do not matter.
>>> p3 = import_module('mpl_toolkits.mplot3d',
... import_kwargs={'fromlist':['something']})

>>> # matplotlib.pyplot can raise RuntimeError when the display cannot be opened
>>> matplotlib = import_module('matplotlib',
... import_kwargs={'fromlist':['pyplot']}, catch=(RuntimeError,))

NTFr   z!Python version is too old to use z (r   z or newer required)   )
stacklevelfromlistr   collections
matplotlibz%s module is not installedz module could not be used ()z version is too old to use ()WARN_OLD_VERSIONWARN_NOT_INSTALLEDwarningssysversion_infowarnjoinmapstrUserWarning
__import__get__name__ImportErrorreprgetattrr   
isinstancer   list)modulemin_module_versionmin_python_versionwarn_not_installedwarn_old_versionmodule_version_attrmodule_version_attr_call_argsimport_kwargscatchr&   mod	from_listsubmode
modversionverstrs                   r   import_modulerE   0   s   ^ -=,H(% 0B0N,(5   00S2D)E FH  A  / 1=1 "%%j"5	F&3<<<+G6C<&01   S6
(4#%BCJ$}5G'HH0#66/F 2UDMBB XXc#/A&BCF !!34F06@A  / JA  MM6?   " MM6<d1gF   	s*   'F ?F F )G?G?(G::G?)__doc__r'   rer%   r$   r   compileVERBOSEr   r   rE   r   r   r   <module>rJ      sn    : 
 	   
& ?? 

12::> .2d$)Kr   