
    h	                     .    e Zd gZddlmZ  G d d       Zy)Plugin    )UnimplementedMethodc                   l    e Zd ZdZed        Zej                  d        Zd Zd Zd Z	ed        Z
d Zy	)
r   z~Base class for plugins.

    These plugins only do one thing: identify cruft. See the 'get_cruft'
    method for details.
    c                 6    t        | d      r| j                  S g S )N
_condition)hasattrr   selfs    ;/usr/lib/python3/dist-packages/janitor/plugincore/plugin.py	conditionzPlugin.condition"   s    ")$"=tE2E    c                     || _         y N)r   )r
   r   s     r   r   zPlugin.condition&   s	    #r   c                     || _         y)z4Set the Application instance this plugin belongs to.N)app)r
   r   s     r   set_applicationzPlugin.set_application*   s	    r   c                 n    | j                         D ]  }|j                           | j                          y)zFFind cruft and clean it up.

        This is a helper method.
        N)	get_cruftcleanuppost_cleanupr
   crufts     r   do_cleanup_cruftzPlugin.do_cleanup_cruft.   s/    
 ^^% 	EMMO	r   c                 ,    t        | j                        )as  Find some cruft in the system.

        This method MUST return an iterator (see 'yield' statement).
        This interface design allows cruft to be collected piecemeal,
        which makes it easier to show progress in the user interface.

        The base class default implementation of this raises an
        exception. Subclasses MUST override this method.
        )r   r   r	   s    r   r   zPlugin.get_cruft7   s     "$..11r   c              #   >   K   | j                         D ]  }|  y wr   )r   r   s     r   r   zPlugin.cruftC   s!     ^^% 	EK	s   c                      y)zDo plugin-wide cleanup after the individual cleanup was performed.

        This is useful for stuff that needs to be processed in batches
        (e.g. for performance reasons) like package removal.
        N r	   s    r   r   zPlugin.post_cleanupH   s     	r   N)__name__
__module____qualname____doc__propertyr   setterr   r   r   r   r   r   r   r   r   r      s_     F F $ $
2  r   N)type__metaclass____all__janitor.plugincore.exceptionsr   r   r   r   r   <module>r(      s"   " * >6 6r   