o
    h                  	   @   s   d Z ddlZddlmZ ddlmZmZ ddlmZm	Z	 ddl
m
Z
 ddlmZ d	Zed
dd	ddedee dee fddZdS )z5Implementing support for MySQL Authentication Plugins    N)	lru_cache)OptionalType   )NotSupportedErrorProgrammingError)logger)BaseAuthPluginzmysql.connector.plugins
   F)maxsizetypedplugin_nameauth_plugin_classreturnc              
   C   s   t }| r[z+td| td|  td|  |}|r!t||s$|j}td| t||W S  tyG } zt	d| W Y d}~nd}~w t
yZ } ztd| |d}~ww td|  d	)
a  Return authentication class based on plugin name

    This function returns the class for the authentication plugin plugin_name.
    The returned class is a subclass of BaseAuthPlugin.

    Args:
        plugin_name (str): Authentication plugin name.
        auth_plugin_class (str): Authentication plugin class name.

    Raises:
        NotSupportedError: When plugin_name is not supported.

    Returns:
        Subclass of `BaseAuthPlugin`.
    zpackage: %szplugin_name: %s.zAUTHENTICATION_PLUGIN_CLASS: %sz"Requested Module was not found: %sNzInvalid module name: zAuthentication plugin 'z' is not supported)DEFAULT_PLUGINS_PKGr   info	importlibimport_modulehasattrAUTHENTICATION_PLUGIN_CLASSgetattrModuleNotFoundErrorwarning
ValueErrorr   r   )r   r   packageplugin_moduleerr r   Y/var/www/html/scripts/venv/lib/python3.10/site-packages/mysql/connector/authentication.pyget_auth_plugin+   s$   r    )N)__doc__r   	functoolsr   typingr   r   errorsr   r   r   pluginsr	   r   strr    r   r   r   r   <module>   s"   
