HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/landscape/lib/__pycache__/plugin.cpython-312.pyc
�

y)�]���f�ddlmZddlZddlmZGd�de�ZGd�de�ZGd	�d
e�Z	y)�)�absolute_importN�)�
format_objectc��eZdZdZy)�PluginConfigErrorz7There was an error registering or configuring a plugin.N)�__name__�
__module__�__qualname__�__doc__���6/usr/lib/python3/dist-packages/landscape/lib/plugin.pyrrs��Ar
rc�(�eZdZdZd�Zd�Zd�Zd�Zy)�PluginRegistryz(A central integration point for plugins.c� �g|_i|_y)N)�_plugins�
_plugin_names��selfs r�__init__zPluginRegistry.__init__s����
���r
c���tjdt|��|jj	|�t|d�r||j|j<|j|�y)aRegister a plugin.

        The plugin's C{register} method will be called with this registry as
        its argument.

        If the plugin has a C{plugin_name} attribute, it will be possible to
        look up the plugin later with L{get_plugin}.
        zRegistering plugin %s.�plugin_nameN)	�logging�inforr�append�hasattrrr�register)r�plugins  r�addzPluginRegistry.addsV��	���-�}�V�/D�E��
�
���V�$��6�=�)�5;�D���v�1�1�2�����r
c��|jS)zGet the list of plugins.)rrs r�get_pluginszPluginRegistry.get_plugins"s���}�}�r
c� �|j|S)z Get a particular plugin by name.)r)r�names  r�
get_pluginzPluginRegistry.get_plugin&s���!�!�$�'�'r
N)rr	r
rrrr!r$rr
rrrs��2� �
��(r
rc��eZdZdZdZd�Zy)�Plugina�A convenience for writing plugins.

    This provides a register method which will set up a bunch of
    reactor handlers in the idiomatic way.

    If C{run} is defined on subclasses, it will be called every C{run_interval}
    seconds after being registered.

    @cvar run_interval: The interval, in seconds, to execute the
    C{run} method. If set to C{None}, then C{run} will not be
    scheduled.
    �c��||_t|d�r>|j�1|jj	|j|j
�yyy)N�run)�registryr�run_interval�reactor�
call_everyr))rr*s  rrzPlugin.register;sG�� ��
��4���D�$5�$5�$A����'�'��(9�(9�4�8�8�D�%B�r
N)rr	r
rr+rrr
rr&r&+s����L�Er
r&)
�
__future__rr�formatr�	Exceptionr�objectrr&rr
r�<module>r2s6��&��!�B�	�B�(�V�(�>E�V�Er