
    	              	          d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlZ ej                  ej                         G d de
             Z G d d	 ej                  d	g d
            Z G d d ej                  dddg            Zy)zBase classes for checks.    )absolute_import)division)unicode_literalsNc                   X    e Zd ZdZej
                  d        Zej                  d        Zy)CheckerzBase class for a single check.c                      y)z7The aspect of the user's machine that is being checked.N selfs    1lib/googlecloudsdk/core/diagnostics/check_base.pyissuezChecker.issue           c                      y)aI  Runs a single check and returns the result and an optional fix.

    Returns:
      A tuple of two elements. The first element should have the same attributes
      as a check_base.Result object. The second element should either be a fixer
      function that can used to fix an error (indicated by the "passed"
      attribute being False in the first element), or None if the check passed
      or if it failed with no applicable fix. If there is a fixer function it is
      assumed that calling it will return True if it makes changes that warrant
      running a check again.
    Nr	   r
   s    r   CheckzChecker.Check#   r   r   N)	__name__
__module____qualname____doc__abcabstractpropertyr   abstractmethodr   r	   r   r   r   r      s9    &B B  r   r   c                   $     e Zd ZdZd fd	Z xZS )Resulta  Holds information about the result of a single check.

  Attributes:
    passed: Whether the check passed.
    message: A summary message about the result of the check.
    failures: A sequence of checkbase.Failure objects; may be empty if there
        were no failures.
  c                 8    t         t        |   | |||xs g       S N)superr   __new__)clspassedmessagefailures	__class__s       r   r   zResult.__new__=   s    %c67HNKKr    Nr   r   r   r   r   __classcell__r#   s   @r   r   r   2   s    L Lr   r   )r    r!   r"   c                   $     e Zd ZdZd fd	Z xZS )FailurezHolds information about the failure of a check.

  Attributes:
    message: A message detailing the failure; to be shown to the user.
    exception: An Exception object associated with the failure.
  c                 .    t         t        |   | ||      S r   )r   r*   r   )r   r!   	exceptionr#   s      r   r   zFailure.__new__I   s    #&sGY??r   r$   r&   r(   s   @r   r*   r*   A   s    @ @r   r*   r!   r,   )r   
__future__r   r   r   r   collectionssixadd_metaclassABCMetaobjectr   
namedtupler   r*   r	   r   r   <module>r4      s      &  ' 
  
 3;;f   ,LK8%FGL	@$k$$YK0HI 	@r   