a
}|g
@ s d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
eeddd Zeed
ddZ
dee eedddZeee dddZee edddZejedddZdS )z#Internal Certbot display utilities. N)List)Optional)messages)misc)msgreturnc C s8 | }g }|D ]}|tj|dddd qd|S )zFormat lines nicely to 80 chars.
:param str msg: Original message
:returns: Formatted message respecting newlines in message
:rtype: str
P F)Zbreak_long_wordsZbreak_on_hyphens
)
splitlinesappendtextwrapfilljoin)r linesZfixed_lline r B/usr/lib/python3.9/site-packages/certbot/_internal/display/util.py
wrap_lines s
r )labelr c C s dj | d | dd dS )znPlace parens around first character of label.
:param str label: Must contain at least one character
z({first}){rest}r N)firstrest)format)r r r r parens_around_char! s r @)prompttimeoutr c C s8 | rt j| t j t|| }|s.t|dS )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 )sysstdoutwriteflushr Zreadline_with_timeoutEOFErrorrstrip)r r r r r r input_with_timeout* s
r# )input_r c C s | dd}dd | D S )zSeparate a comma or space separated list.
:param str input_: input from the user
:returns: strings
:rtype: list
, c S s g | ]}t |qS r )str).0stringr r r