Your IP : 216.73.216.224


Current Path : /lib/python3/dist-packages/certbot/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/certbot/__pycache__/reporter.cpython-38.pyc

U

�]�
�@s�dZddlmZddlZddlZddlZddlZddlmZddl	Z
ddlmZddlm
Z
e�e�Ze
j�ej�Gdd�de��ZdS)	z.Collects and displays information to the user.�)�print_functionN)�queue)�
interfaces)�utilc@sBeZdZdZdZdZdZe�dd�Z	dd�Z
dd
d�Zdd
�ZdS)�Reporterz�Collects and displays information to the user.

    :ivar `queue.PriorityQueue` messages: Messages to be displayed to
        the user.

    r��ZReporterMsgzpriority text on_crashcCst��|_||_dS�N)rZ
PriorityQueue�messages�config)�selfr�r
�2/usr/lib/python3/dist-packages/certbot/reporter.py�__init__%s
zReporter.__init__TcCsD|j|kr|jksnt�|j�|�|||��t�d|�dS)aXAdds msg to the list of messages to be printed.

        :param str msg: Message to be displayed to the user.

        :param int priority: One of `HIGH_PRIORITY`, `MEDIUM_PRIORITY`,
            or `LOW_PRIORITY`.

        :param bool on_crash: Whether or not the message should be
            printed if the program exits abnormally.

        zReporting to user: %sN)�
HIGH_PRIORITY�LOW_PRIORITY�AssertionErrorr
Zput�	_msg_type�logger�debug)r�msg�priority�on_crashr
r
r�add_message)szReporter.add_messagecsDd}|j��snt��ddk}tj��}|jjsF|r>tt	j
�td�tjddddd�}tj|j
|j
ddd��|j���s"|j��}|jjr�|j|jkrn|js�qn|s�|jrn|r�|j|jkr�|jjs�tj�t	j�d}|j��}t|�|d��t|�dkrntd	��fd
d�|dd�D���qn|�r@|jj�s@tj�t	j�dS)z�Prints messages to the user and clears the message queue.

        If there is an unhandled exception, only messages for which
        ``on_crash`` is ``True`` are printed.

        FrNzIMPORTANT NOTES:z - z   )Zinitial_indent�subsequent_indentZbreak_long_wordsZbreak_on_hyphensr�
c3s|]}��|�VqdSr	)�fill)�.0�line�Znext_wrapperr
r�	<genexpr>asz*Reporter.print_messages.<locals>.<genexpr>)r
�empty�sys�exc_info�stdout�isattyr�quiet�printrZ
ANSI_SGR_BOLD�textwrapZTextWrapperr�getrrr�writeZANSI_SGR_RESET�text�
splitlinesr�len�join)rZbold_onZno_exceptionZ
first_wrapperr�linesr
rr�print_messages9sL


��



�zReporter.print_messagesN)T)
�__name__�
__module__�__qualname__�__doc__rZMEDIUM_PRIORITYr�collections�
namedtuplerrrr0r
r
r
rrs
r)r4Z
__future__rr5Zloggingr"r(Z	six.movesrZzope.interface�zopeZcertbotrrZ	getLoggerr1rZ	interfaceZimplementerZ	IReporter�objectrr
r
r
r�<module>s