o
    È·e—
  ã                   @   sN   d Z ddlZddlZddlZG dd„ deƒZddd„Zdd„ Zd	a	d
d„ Z
dS )a  
Implements plugin related api.

To define a new plugin just subclass Plugin, like this.

class AuthPlugin(Plugin):
    pass

Then start creating subclasses of your new plugin.

class MyFancyAuth(AuthPlugin):
    capability = ['sign', 'vmac']

The actual interface is duck typed.
é    Nc                   @   s    e Zd ZdZg Zedd„ ƒZdS )ÚPluginzBase class for all plugins.c                 C   s   |D ]
}|| j vr dS qdS )zMReturns true if the requested capability is supported by this plugin
        FT)Ú
capability)ÚclsÚrequested_capabilityÚc© r   úB/var/www/ideatree/venv/lib/python3.10/site-packages/boto/plugin.pyÚ
is_capable1   s
   
ÿzPlugin.is_capableN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr	   r   r   r   r   r   ,   s
    r   c                 C   s2   |sg }g }|   ¡ D ]}| |¡r| |¡ q
|S ©N)Ú__subclasses__r	   Úappend)r   r   ÚresultÚhandlerr   r   r   Ú
get_plugin;   s   

€r   c                 C   sf   t j | ¡\}}t j |¡\}}t ||g¡\}} }zt ||| |¡W |r*| ¡  S S |r2| ¡  w w r   )ÚosÚpathÚsplitÚsplitextÚimpÚfind_moduleÚload_moduleÚclose)Úfilenamer   ÚnameÚextÚfileÚdatar   r   r   Ú_import_moduleE   s   
ÿ
ÿr"   Fc                 C   sN   t rd S da |  dd¡sd S |  dd¡}t tj |d¡¡D ]}t|ƒ qd S )NTr   Úplugin_directoryz*.py)Ú_plugin_loadedÚ
has_optionÚgetÚglobr   r   Újoinr"   )ÚconfigÚ	directoryr    r   r   r   Úload_pluginsS   s   
ÿr+   r   )r   r'   r   Úos.pathr   Úobjectr   r   r"   r$   r+   r   r   r   r   Ú<module>   s   

