
    ɯei                       d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ dd	lmZ  e	e      Z	  G d
 d      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zeeef   Z	 	 	 	 	 	 	 	 ddZ	 	 ddZddZddZ	 	 ddZ  e       \  Z!Z"Z# e       \  Z$Z% e       \  Z&Z'Z( e        \  Z)Z*Z+y)     )annotationsN)PackageNotFoundErrordistribution)	getLogger)
ModuleType)Union)Requirement   )errorsc                      e Zd ZdZdZd Zy)MissingOptionalDependencyzA class to replace missing dependencies.

    The only thing this class is supposed to do is raise a MissingDependencyError when __getattr__ is called.
    This will be triggered whenever module.member is going to be called.
    znot setc                @    t        j                  | j                        )N)r   MissingDependencyError	_dep_name)selfitems     ]/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/snowflake/connector/options.py__getattr__z%MissingOptionalDependency.__getattr__#   s    ++DNN;;    N)__name__
__module____qualname____doc__r   r    r   r   r   r      s     I<r   r   c                      e Zd ZdZdZy)MissingPandasz9The class is specifically for pandas optional dependency.pandasNr   r   r   r   r   r   r   r   r   r   '   s
    CIr   r   c                      e Zd ZdZdZy)MissingKeyringz6The class is specifically for sso optional dependency.keyringNr   r   r   r   r    r    -   s
    @Ir   r    c                      e Zd ZdZdZy)MissingBotocore7The class is specifically for boto optional dependency.botocoreNr   r   r   r   r#   r#   3   s
    AIr   r#   c                      e Zd ZdZdZy)MissingBoto38The class is specifically for boto3 optional dependency.boto3Nr   r   r   r   r'   r'   9   s
    BIr   r'   c                      e Zd ZdZdZy)MissingAioBotocorer$   aiobotocoreNr   r   r   r   r+   r+   ?   s
    AIr   r+   c                      e Zd ZdZdZy)MissingAioBoto3r(   aioboto3Nr   r   r   r   r.   r.   E   s
    BIr   r.   c                T    t        j                  dj                  | ||      d       y )NzgYou have an incompatible version of '{}' installed ({}), please install a version that adheres to: '{}'   )
stacklevel)warningswarnformat)dep_nameinstalled_verexpected_vers      r   warn_incompatible_depr9   N   s&     MM	!6(M<Hr   c                    	 t        j                  d      } ddlm} t        j                  d      }dt        j
                  vrdt        j
                  d<   	 t        d      }t        d      }|j                  j                  dg       }d	}|D ]K  }t        |      }|j                  |j                  j                  d
di      s9|j                  dk(  sI|} n |j                  }	|j                  j                  |	      st!        d|	|       | |dfS # t"        $ r"}
t$        j'                  d|
        Y d	}
~
+d	}
~
ww xY w# t(        $ r t+               t+               dfcY S w xY w)a
  This function tries importing the following packages: pandas, pyarrow.

    If available it returns pandas and pyarrow packages with a flag of whether they were imported.
    It also warns users if they have an unsupported pyarrow version installed if possible.
    r   r   )	DataFramepyarrowARROW_DEFAULT_MEMORY_POOLsystemzsnowflake-connector-pythonzRequires-DistNextrazSCannot determine if compatible pyarrow is installed because of missing package(s): TF)	importlibimport_moduler   r;   osenvironr   metadataget_allr	   markerevaluatenameversion	specifiercontainsr9   r   loggerinfoImportErrorr   )r   r;   r<   pyarrow_distsnowflake_connector_distdependenciespandas_pyarrow_extra
dependencydepinstalled_pyarrow_versiones              r    _import_or_missing_pandas_optionrW   X   sg   *7((2$)))4 'bjj86>BJJ23	'	2L'34P'Q$3<<DDL $( * 
!*-JJ*

++Wh,?@I-+.( )5(<(<%'11::;TU%8:N w$$	 $ 	KKefgehi 	
  7667sO   AE AD )D D 9D E 	E D;6E ;E  E E$#E$c                 l    	 t        j                  d      } | dfS # t        $ r t               dfcY S w xY w)zThis function tries importing the following packages: keyring.

    If available it returns keyring package with a flag of whether it was imported.
    r!   TF)r@   rA   rN   r    )r!   s    r   !_import_or_missing_keyring_optionrY      s>    
')))4} '&&'s    33c                     	 t        j                  d      } t        j                  d      }| |dfS # t        $ r t               t	               dfcY S w xY w)IThis function tries importing the following packages: botocore and boto3.r%   r)   TF)r@   rA   rN   r#   r'   )r%   r)   s     r   _import_or_missing_boto_optionr\      sU    8**:6''0$$ 8 ,.%778   .1 AAc                     	 t        j                  d      } t        j                  d      }| |dfS # t        $ r t               t	               dfcY S w xY w)r[   r,   r/   TF)r@   rA   rN   r+   r.   )r,   r/   s     r   !_import_or_missing_aioboto_optionr_      sV    >--m<**:6Hd** >!#_%6==>r]   )r6   strr7   r`   r8   r	   returnNone)ra   z/tuple[ModuleLikeObject, ModuleLikeObject, bool])ra   ztuple[ModuleLikeObject, bool]),
__future__r   r@   rB   r3   importlib.metadatar   r   loggingr   typesr   typingr   packaging.requirementsr	    r   r   rL   r   r   r    r#   r'   r+   r.   ModuleLikeObjectr9   rW   rY   r\   r_   r   r<   installed_pandasr!   installed_keyringr%   r)   installed_botor,   r/   installed_aiobotor   r   r   <module>ro      s'   "  	  A    . 	8	
< 
<- . / , 2 /  %>>? "%5@	27327j	'8	>3	> %E$F !!>@ 	"@"B %+L+N (X(r   