File: //lib/python3/dist-packages/certbot/_internal/display/__pycache__/util.cpython-312.pyc
�
M/�e�
� �� � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
dedefd �Zd
edefd�Z
ddee d
edefd�Zdedee fd�Zdee defd�Zdej$ defd�Zy)z#Internal Certbot display utilities.� N)�List)�Optional)�messages)�misc�msg�returnc � � | j � }g }|D ]* }|j t j |ddd�� � �, dj |� S )z�Format 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 � �
�N�N��E��G�� %�����x�}�}���"�"� $� %�%� �9�9�W��� �labelc �4 � dj | d | dd �� 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$ � � �#�#�%��(��q�r��#�C�Cr �prompt�timeoutc �� � | r=t j j | � t j j � t j
|| � }|st �|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 � �&