
    M/ed                     "   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej                  Z	 ej                  Z		 dZ
ded	d
fdZ	 	 ddededededed	d
fdZ	 	 d dedeee   eeeef      f   dee   dee   ded	eeef   fdZ	 	 d dedee   dee   ded	eeef   f
dZ	 	 	 d!dedededee   dee   ded	efdZ	 	 	 d dedee   deee      dee   ded	eeee   f   fdZ	 	 d dedee   dee   ded	eeef   f
dZdedededed	d
f
dZy
)"a$  Certbot display.

This module (`certbot.display.util`) or its companion `certbot.display.ops`
should be used whenever:

- Displaying status information to the user on the terminal
- Collecting information from the user via prompts

Other messages can use the `logging` module. See `log.py`.

    )List)Optional)Tuple)Union)objH   msgreturnNc                 R    t        j                         j                  | ddd       y)zMDisplay a basic status message.

    :param str msg: message to display

    F)pausedecoratewrapNr   get_displaynotification)r	   s    6/usr/lib/python3/dist-packages/certbot/display/util.pynotifyr      s"     OO""3ee%"P    messager   r   force_interactiver   c                 T    t        j                         j                  | ||||       y)a  Displays a notification and waits for user acceptance.

    :param str message: Message to display
    :param bool pause: Whether or not the program should pause for the
        user's confirmation
    :param bool wrap: Whether or not the application should wrap text
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions
    :param bool decorate: Whether to surround the message with a
        decorated frame

    )r   r   r   r   Nr   )r   r   r   r   r   s        r   r   r   &   s+     OO""7%d5FQY # [r   choicesdefaultcli_flagc                 R    t        j                         j                  | ||||      S )a  Display a menu.

    .. todo:: This doesn't enable the help label/button (I wasn't sold on
        any interface I came up with for this). It would be a nice feature.

    :param str message: title of menu
    :param choices: Menu lines, len must be > 0
    :type choices: list of tuples (tag, item) or
        list of descriptions (tags will be enumerated)
    :param default: default value to return, if interaction is not possible
    :param str cli_flag: option used to set this value with the CLI
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions

    :returns: tuple of (`code`, `index`) where
        `code` - str display exit code
        `index` - int index of the user's selection

    :rtype: tuple

    r   r   r   )r   r   menu)r   r   r   r   r   s        r   r   r   8   s0    0 ??!!'7Gh4E " G Gr   c                 P    t        j                         j                  | |||      S )a  Accept input from the user.

    :param str message: message to display to the user
    :param default: default value to return, if interaction is not possible
    :param str cli_flag: option used to set this value with the CLI
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions

    :returns: tuple of (`code`, `input`) where
        `code` - str display exit code
        `input` - str of the user's input
    :rtype: tuple

    r   )r   r   inputr   r   r   r   s       r   
input_textr!   T   s.      ??""7Gh5F # H Hr   	yes_labelno_labelc                 T    t        j                         j                  | |||||      S )a~  Query the user with a yes/no question.

    Yes and No label must begin with different letters, and must contain at
    least one letter each.

    :param str message: question for the user
    :param str yes_label: Label of the "Yes" parameter
    :param str no_label: Label of the "No" parameter
    :param default: default value to return, if interaction is not possible
    :param str cli_flag: option used to set this value with the CLI
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions

    :returns: True for "Yes", False for "No"
    :rtype: bool

    )r"   r#   r   r   r   )r   r   yesno)r   r"   r#   r   r   r   s         r   r%   r%   h   s4    ( ??""7i(\c,4HY # [ [r   tagsc                 R    t        j                         j                  | ||||      S )a'  Display a checklist.

    :param str message: Message to display to user
    :param list tags: `str` tags to select, len(tags) > 0
    :param default: default value to return, if interaction is not possible
    :param str cli_flag: option used to set this value with the CLI
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions

    :returns: tuple of (`code`, `tags`) where
        `code` - str display exit code
        `tags` - list of selected tags
    :rtype: tuple

    r   )r   r   	checklist)r   r&   r   r   r   s        r   r(   r(      s1    $ ??&&wgPX9J ' L Lr   c                 P    t        j                         j                  | |||      S )a  Display a directory selection screen.

    :param str message: prompt to give the user
    :param default: default value to return, if interaction is not possible
    :param str cli_flag: option used to set this value with the CLI
    :param bool force_interactive: True if it's safe to prompt the user
        because it won't cause any workflow regressions

    :returns: tuple of the form (`code`, `string`) where
        `code` - display exit code
        `string` - input entered by the user

    r   )r   r   directory_selectr    s       r   r*   r*      s/     ??--gwQY@Q . S Sr   promptc                 j    dj                  |       }|r|dj                  |      z  }|
|sJ |       yy)a0  Verify that provided arguments is a valid display call.

    :param str prompt: prompt for the user
    :param default: default answer to prompt
    :param str cli_flag: command line option for setting an answer
        to this question
    :param bool force_interactive: if interactivity is forced

    z)Invalid display call for this prompt:
{0}z7
You can set an answer to this prompt with the {0} flagN)format)r+   r   r   r   r	   s        r   assert_valid_callr.      sK     7
=
=f
EC 006x0@	B"38S83"3r   )TTFT)NNF)YesNoNNF)__doc__typingr   r   r   r   certbot._internal.displayr   OKCANCELWIDTHstrr   boolr   intr   r!   r%   r(   r*   r.    r   r   <module>r;      s|  
     ) 	VV 3	 9
Q Q Q AECG[# [d [ [$([<@[LP[& CG#(G# Gd3ieCHo1F&F G G3-G2:3-G G-238_G8 W[).H Hhsm Hhsm H"&H38c?H( AEDH$)[3 [3 [# [D>[4<SM[![.2[0 MQ(,(-Ls L$s) LhtCy6I L L!%L27T#Y2GL, ]a/4Sc SHSM SHUXM S(,S9>sCxS&9c 9C 93 9SW 9\` 9r   