o 6a%@sjdZddlZddlmZddlmZddlmZddlmZddlmZddlm Z ddl Z dd l m Z dd l m Z dd l mZdd lmZdd lmZddlmZddlmZejZ ejZ dZdZ dZ deddfddZ  d6dedededededdf ddZ  d7ded e eeeeeffd!eed"eededeeeff d#d$Z  d7ded!eed"eededeeeff d%d&Z (  d8ded)ed*ed!eed"eededefd+d,Z!   d7ded-eed!eed"eededeeeeff d.d/Z"  d7ded!eed"eededeeeff d0d1Z#d2d3Z$Gd4d5d5Z%eee%ej&e'ej&e'<dS)9a$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`. N) ModuleType)cast)List)Optional)Tuple)Union) FileDisplay)NoninteractiveDisplay) SIDE_FRAME)input_with_timeout)separate_list_input)summarize_domain_list)objHhelpescmsgreturncCstj|dddddS)zMDisplay a basic status message. :param str msg: message to display F)pausedecoratewrapNr get_display notification)rr6/usr/lib/python3/dist-packages/certbot/display/util.pynotify5srTFmessagerrforce_interactivercCstj|||||ddS)aDisplays 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 )rrrrNr)rrrrrrrrr>s rchoicesdefaultcli_flagcCtj|||||dS)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 one exists) :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)rrmenu)rrr r!rrrrr$Psr$cCtj||||dS)aAccept input from the user. :param str message: message to display to the user :param default: default value to return (if one exists) :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#)rrinputrr r!rrrr input_textlsr(YesNo yes_labelno_labelcCstj||||||dS)anQuery 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 one exists) :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)rryesno)rr+r,r r!rrrrr-sr-tagscCr")aDisplay 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 one exists) :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#)rr checklist)rr.r r!rrrrr/sr/cCr%)aDisplay a directory selection screen. :param str message: prompt to give the user :param default: default value to return (if one exists) :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#)rrdirectory_selectr'rrrr0sr0cCs8d|}|r|d|7}|dus|sJ|dSdS)a0Verify 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)promptr r!rrrrrassert_valid_calls r3c@s8eZdZdZddZddZddZdd Zd d Zd S) _DisplayUtilDeprecationModulez Internal class delegating to a module, and displaying warnings when attributes related to deprecated attributes in the certbot.display.util module. cCs||jd<dSN_module)__dict__)selfmodulerrr__init__sz&_DisplayUtilDeprecationModule.__init__cCs*|dvrtjd|tddt|j|S)N) rr r r r r WIDTHHELPESCzT{0} attribute in certbot.display.util module is deprecated and will be removed soon.) stacklevel)warningswarnr1DeprecationWarninggetattrr6r8attrrrr __getattr__s  z)_DisplayUtilDeprecationModule.__getattr__cCst|j||dSN)setattrr6)r8rEvaluerrr __setattr__sz)_DisplayUtilDeprecationModule.__setattr__cCst|j|dSrG)delattrr6rDrrr __delattr__z)_DisplayUtilDeprecationModule.__delattr__cCsdgt|jSr5)dirr6)r8rrr__dir__rMz%_DisplayUtilDeprecationModule.__dir__N) __name__ __module__ __qualname____doc__r:rFrJrLrOrrrrr4s r4)TTFT)NNF)r)r*NNF)(rSsystypesrtypingrrrrrr@certbot._internal.display.objrr r certbot._internal.display.utilr r r certbot._internal.displayrOKCANCELr;r<r=strrboolrintr$r(r-r/r0r3r4modulesrPrrrrs