
    M/e                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 dedefd	Zd
edefdZddee   dedefdZdedee   fdZdee   defdZdej$                  defdZy)z#Internal Certbot display utilities.    N)List)Optional)messages)miscmsgreturnc           	          | j                         }g }|D ]*  }|j                  t        j                  |ddd             , dj	                  |      S )zFormat lines nicely to 80 chars.

    :param str msg: Original message

    :returns: Formatted message respecting newlines in message
    :rtype: str

    P   F)break_long_wordsbreak_on_hyphens
)
splitlinesappendtextwrapfilljoin)r   linesfixed_llines       @/usr/lib/python3/dist-packages/certbot/_internal/display/util.py
wrap_linesr      sX     NNEG %x}}""	$ 	%% 99W    labelc                 4    dj                  | d   | dd       S )znPlace parens around first character of label.

    :param str label: Must contain at least one character

    z({first}){rest}r      N)firstrest)format)r   s    r   parens_around_charr   !   s$     ##%(qr#CCr   prompttimeoutc                     | r=t         j                  j                  |        t         j                  j                          t	        j
                  ||       }|st        |j                  d      S )a  Get user input with a timeout.

    Behaves the same as the builtin input, however, an error is raised if
    a user doesn't answer after timeout seconds. The default timeout
    value was chosen to place it just under 12 hours for users following
    our advice and running Certbot twice a day.

    :param str prompt: prompt to provide for input
    :param float timeout: maximum number of seconds to wait for input

    :returns: user response
    :rtype: str

    :raises errors.Error if no answer is given before the timeout

    r   )sysstdoutwriteflushr   readline_with_timeoutEOFErrorrstrip)r    r!   r   s      r   input_with_timeoutr*   *   sR    & 

 

%%gv6D;;tr   input_c                 ~    | j                  dd      }|j                         D cg c]  }t        |       c}S c c}w )zSeparate a comma or space separated list.

    :param str input_: input from the user

    :returns: strings
    :rtype: list

    , )replacesplitstr)r+   	no_commasstrings      r   separate_list_inputr4   H   s5     sC(I '0oo&78FCK888s   :domainsc                     | syt        |       }|dk(  r| d   S |dk(  rdj                  |       S dj                  | d   |dz
        S )aM  Summarizes a list of domains in the format of:
        example.com.com and N more domains
    or if there is are only two domains:
        example.com and www.example.com
    or if there is only one domain:
        example.com

    :param list domains: `str` list of domains
    :returns: the domain list summary
    :rtype: str
     r   r      z and z{0} and {1} more domains)lenr   r   )r5   lengths     r   summarize_domain_listr;   W   sU     \F{qz	1||G$$)00VAXFFr   errorc                     | j                   | j                  f}t        |      rdj                  d |D              S | j                  r| j                  S | j
                  S )zReturns a human-readable description of an RFC7807 error.

    :param error: The ACME error
    :returns: a string describing the error, suitable for human consumption.
    :rtype: str
    z :: c              3   &   K   | ]	  }||  y w)N ).0parts     r   	<genexpr>z&describe_acme_error.<locals>.<genexpr>x   s     FDT5E4Fs   )titledetailanyr   descriptiontyp)r<   partss     r   describe_acme_errorrI   o   sQ     [[%,,'E
5z{{FEFFF   99r   )Ng     @)__doc__r#   r   typingr   r   acmer   acme_messagescertbot.compatr   r1   r   r   floatr*   r4   r;   ErrorrI   r?   r   r   <module>rQ      s    ) 
    * C C ,Dc Dc Dx} e RU <9 9S	 9G49 G G0}22 s r   