
    c                         d Z ddlmZ ddlmZmZ ddlmZ  G d d ee                    Z G d de          Z	d	a
d
 Z G d de          Zd Zd	S )z!Frontend class representing a UX.    )absolute_import)ABCMetaabstractmethod)with_metaclassc                   V    e Zd ZdZd Zd Zd Zd Zed             Z	ed             Z
dS )	Frontendz-A UX (CLI, GUI, etc.) for project operations.c                 "    d| _         d| _        dS )zConstruct a Frontend. N)	_info_buf
_error_buf)selfs    9lib/python3.11/site-packages/anaconda_project/frontend.py__init__zFrontend.__init__   s        c                     ||z   }|                     d          \  }}}|dk    rK|                    d          r
|d d         } ||           |}|                     d          \  }}}|dk    K|S )N
r
   )	partitionendswith)r   databufline_handlerstartsepends          r   _partialzFrontend._partial   s    DjMM$//SRi 	4 ~~d## #crc
LC #d 3 3UC Ri 	4 
r   c                 R    |                      || j        | j                  | _        dS )a  Log only part of an info-level line.

        The default implementation buffers this until a line separator
        and then passes the entire line to info().
        Subtypes can override this if they want to print output
        immediately as it arrives.
        N)r   r   infor   r   s     r   partial_infozFrontend.partial_info(   s#     tT^TYGGr   c                 R    |                      || j        | j                  | _        dS )a  Log only part of an error-level line.

        The default implementation buffers this until a line separator
        and then passes the entire line to error().
        Subtypes can override this if they want to print output
        immediately as it arrives.
        N)r   r   errorr    s     r   partial_errorzFrontend.partial_error2   s#     --dotzJJr   c                     dS zLog an info-level message.N r   messages     r   r   zFrontend.info<   s	     	r   c                     dS )zLog an error-level message.

        A rule of thumb is that if a function also returns a
        ``Status``, this message should also be appended to the
        ``errors`` field on that status.
        Nr'   r(   s     r   r#   zFrontend.errorA   s	     	r   N)__name__
__module____qualname____doc__r   r   r!   r$   r   r   r#   r'   r   r   r   r      s        77  
  "H H HK K K   ^   ^  r   r   c                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )NullFrontendz$A frontend that doesn't do anything.c                 V    t          t          |                                            dS )zConstruct a null frontend.N)superr0   r   )r   	__class__s    r   r   zNullFrontend.__init__S   s%    lD!!**,,,,,r   c                     dS )zPart of a log message.Nr'   r    s     r   r!   zNullFrontend.partial_infoW       r   c                     dS )zPart of an error message.Nr'   r    s     r   r$   zNullFrontend.partial_error[   r5   r   c                     dS r&   r'   r(   s     r   r   zNullFrontend.info_   r5   r   c                     dS zLog an error-level message.Nr'   r(   s     r   r#   zNullFrontend.errorc   r5   r   )
r+   r,   r-   r.   r   r!   r$   r   r#   __classcell__r3   s   @r   r0   r0   Q   sz        ..- - - - -            r   r0   Nc                  :    t           t                      a t           S N)_singleton_null_frontendr0   r'   r   r   _null_frontendr?   k   s     2#/>> ##r   c                   0     e Zd Z fdZd Zd Zd Z xZS )_ErrorRecordingFrontendProxyc                 r    t          t          |                                            g | _        || _        d S r=   )r2   rA   r   _errors
underlying)r   rD   r3   s     r   r   z%_ErrorRecordingFrontendProxy.__init__s   s2    *D11::<<<$r   c                 :    | j                             |           dS r&   )rD   r   r(   s     r   r   z!_ErrorRecordingFrontendProxy.infox   s    W%%%%%r   c                 n    | j                             |           | j                            |           dS r9   )rC   appendrD   r#   r(   s     r   r#   z"_ErrorRecordingFrontendProxy.error|   s4    G$$$g&&&&&r   c                 "    | j         }g | _         |S r=   )rC   )r   results     r   
pop_errorsz'_ErrorRecordingFrontendProxy.pop_errors   s    r   )r+   r,   r-   r   r   r#   rJ   r:   r;   s   @r   rA   rA   r   se        % % % % %
& & &' ' '
      r   rA   c                      t          |           S r=   )rA   )frontends    r   _new_error_recorderrM      s    '111r   )r.   
__future__r   abcr   r   #anaconda_project.internal.metaclassr   r   r0   r>   r?   rA   rM   r'   r   r   <module>rQ      s   ( ' & & & & & & ' ' ' ' ' ' ' ' > > > > > >9 9 9 9 9~~g&& 9 9 9B    8   .   $ $ $    8   *2 2 2 2 2r   