2bi',SSKJrJrJrJrJrJrJrJr SSK J r SSK J r SSK JrJr \"S5r\"S5r"SS \5r"S S \5r"S S \\5r"SS\\5r"SS\\5r"SS\\5r"SS\\5r\S:XaSSKJr \RASSS9(a\RASSS9r!\!S:a\!S::aO \"S5 M'\"S\!35 \RAS SS!9r"\#"\"5S:aO \"S"5 M'\"S#\"<35 \RAS$/S%QS&9r$\"S'\$<35 g)\"S(5 g)g))*)AnyGenericListOptionalTextIOTypeVarUnionoverload) get_console)Console)TextTextType PromptType DefaultTypec\rSrSrSrSrg) PromptError z/Exception base class for prompt related errors.N)__name__ __module__ __qualname____firstlineno____doc____static_attributes__rډ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/rich/prompt.pyrr s9rrc8\rSrSrSrS\SS4SjrS\4SjrSrg) InvalidResponsezException to indicate a response was invalid. Raise this within process_response() to indicate an error and provide an error message. Args: message (Union[str, Text]): Error message. messagereturnNcXlgNr!)selfr!s r__init__InvalidResponse.__init__s rcUR$r$r%r&s r__rich__InvalidResponse.__rich__s ||rr%) rrrrrrr'r+rrrrrrs&T(rrc\rSrSr%Sr\r\\S'Sr Sr Sr Sr \ \\\S'S*SS SS S S .S \S \ \S\S\ \\S\S\SS4Sjjjr\\S*SS SS S SS.S \S \ \S\S\ \\S\S\S\S\ \S\\\44Sjjj55r\\S*SS SS S SS.S \S \ \S\S\ \\S\S\S\ \S\4Sjjj55r\S*SS SS S SSS.S \S \ \S\S\ \\S\S\S\S\ \S\4Sjjj5rS\S\4SjrS\S\4Sjr\S+S \S \S\S\ \S\4 Sjj5rS\S\4SjrS\S\4S jr S\S!\!SS4S"jr"S,S#jr#\SS$.S\ \S\4S%jj5r$\SS$.S\S\ \S\\\44S&jj5r$SSS'.S\S\ \S\4S(jjr$S)r%g)- PromptBasea\Ask the user for input until a valid response is received. This is the base class, see one of the concrete classes for examples. Args: prompt (TextType, optional): Prompt text. Defaults to "". console (Console, optional): A Console instance or None to use global console. Defaults to None. password (bool, optional): Enable password input. Defaults to False. choices (List[str], optional): A list of valid choices. Defaults to None. show_default (bool, optional): Show default in prompt. Defaults to True. show_choices (bool, optional): Show choices in prompt. Defaults to True. response_typez*[prompt.invalid]Please enter a valid valuezA[prompt.invalid.choice]Please select one of the available optionsz: NchoicesFTconsolepasswordr1 show_default show_choicespromptr3r4r5r6r"cU=(d [5Ul[U[5(a[R "USS9OUUlX0lUbX@lXPl X`l g)Nr7style) r r3 isinstancestrr from_markupr7r4r1r5r6)r&r7r3r4r1r5r6s rr'PromptBase.__init__5s[/+- &#&&   V8 4 !  "L((r)r3r4r1r5r6streamdefaultr?cgr$r) clsr7r3r4r1r5r6r@r?s raskPromptBase.askKs rcgr$r)rBr7r3r4r1r5r6r?s rrCrD[s r.)r3r4r1r5r6r@r?c $U"UUUUUUS9n U "XxS9$)aShortcut to construct and run a prompt loop and return the result. Example: >>> filename = Prompt.ask("Enter a filename") Args: prompt (TextType, optional): Prompt text. Defaults to "". console (Console, optional): A Console instance or None to use global console. Defaults to None. password (bool, optional): Enable password input. Defaults to False. choices (List[str], optional): A list of valid choices. Defaults to None. show_default (bool, optional): Show default in prompt. Defaults to True. show_choices (bool, optional): Show choices in prompt. Defaults to True. stream (TextIO, optional): Optional text file open for reading to get input. Defaults to None. r2r@r?r) rBr7r3r4r1r5r6r@r?_prompts rrCrDjs-6 %%  w66rc"[SUS3S5$)zTurn the supplied default in to a Text instance. Args: default (DefaultType): Default value. Returns: Text: Text containing rendering of default value. ()prompt.default)r)r&r@s rrender_defaultPromptBase.render_defaultsayN$455rc URR5nSUlUR(aUUR(aDSR UR5nSUS3nUR S5 UR US5 US:waeUR(aT[U[UR45(a3UR S5 URU5nUR U5 UR UR5 U$)zrMake prompt text. Args: default (DefaultType): Default value. Returns: Text: Text to display in prompt. /[] zprompt.choices.) r7copyendr6r1joinappendr5r;r<r0rM prompt_suffix)r&r@r7_choicesr1_defaults r make_promptPromptBase.make_prompts!!#   xx -H(1oG MM#  MM'#3 4 sN!!7S$*<*<$=>> MM# **73H MM( # d(() rc"URX#US9$)zGet input from user. Args: console (Console): Console instance. prompt (TextType): Prompt text. password (bool): Enable password entry. Returns: str: String from user. )r4r?)input)rBr3r7r4r?s r get_inputPromptBase.get_inputs$}}Vv}FFrvaluecZURceUR5UR;$)zCheck value is in the list of valid choices. Args: value (str): Value entered by user. Returns: bool: True if choice was valid, otherwise False. )r1stripr&rbs r check_choicePromptBase.check_choices)||'''{{} ,,rcUR5nURU5nUR b+UR U5(d[UR5eU$![a [UR5ef=f)zProcess response from user, convert to prompt type. Args: value (str): String typed by user. Raises: InvalidResponse: If ``value`` is invalid. Returns: PromptType: The value to be returned from ask method. )rdr0 ValueErrorrvalidate_error_messager1rfillegal_choice_message)r&rb return_values rprocess_responsePromptBase.process_responsesy  ?'+'9'9%'@L << #D,=,=e,D,D!$"="=> >  ?!$"="=> > ?s A A=errorc:URRU5 g)zCalled to handle validation error. Args: value (str): String entered by user. error (InvalidResponse): Exception instance the initiated the error. N)r3print)r&rbros ron_validate_errorPromptBase.on_validate_errors 5!rcg)z,Hook to display something before the prompt.Nrr*s r pre_promptPromptBase.pre_promptsrr?cgr$r)r&r?s r__call__PromptBase.__call__s rcgr$r)r&r@r?s rryrzs rrGc&UR5 URU5nURURX0RUS9nUS:XaUS:waU$UR U5nU$![ anURXF5 SnAMSnAff=f)z|Run the prompt loop. Args: default (Any, optional): Optional default value. Returns: PromptType: Processed value. rwrP.N)rur\r`r3r4rmrrr)r&r@r?r7rbrlros rryrzs OO %%g.FNN4<<vNVE{w#~ $#44U; $# # &&u4 sA** B4B  B)r1r3r4r7r6r5)rPr$)r"N)&rrrrrr<r0type__annotations__rjrkrYr1rrrr boolr' classmethodr rrr rrCrrrMr\r`rfrmrrrruryrrrrr.r.s M4IKM#'GXd3i ')&*'+!!))'" )  ) $s)$ ))) ),   &*'+!!#'    '"    $s)$            {J& '       &*'+!!#'    '"    $s)$              "7&*'+!!#'"7"7'" "7  "7 $s)$ "7"7"7"7 "7 "7"7H 6k 6d 6;4> $( GGG G  G GG& -# -$ -cj."s"?"t";59 (6"2 j  BF % /7/? z;& '  *-$3$hv6F$RU$$rr.c\rSrSrSr\rSrg)PromptizVA prompt that returns a str. Example: >>> name = Prompt.ask("Enter your name") rN)rrrrrr<r0rrrrrrsMrrc \rSrSrSr\rSrSrg) IntPrompti*z}A prompt that returns an integer. Example: >>> burrito_count = IntPrompt.ask("How many burritos do you want to order") z3[prompt.invalid]Please enter a valid integer numberrN) rrrrrintr0rjrrrrrr*sMRrrc \rSrSrSr\rSrSrg) FloatPrompti6zmA prompt that returns a float. Example: >>> temperature = FloatPrompt.ask("Enter desired temperature") z%[prompt.invalid]Please enter a numberrN) rrrrrfloatr0rjrrrrrr6sMDrrc^\rSrSr%Sr\rSrSS/r\ \ \ S'S\ S\ 4S jrS \ S\4S jrS rg )ConfirmiBzeA yes / no confirmation prompt. Example: >>> if Confirm.ask("Continue"): run_job() z#[prompt.invalid]Please enter Y or Nynr1r@r"cZURup#[U(a SUS3SS9$SUS3SS9$)z8Render the default as (y) or (n) rather than True/False.rJrKrLr9)r1r)r&r@yesnos rrMConfirm.render_defaultOs8,,'auAJ@PQQ2$ay@PQQrrbcUR5R5nXR;a[UR5eXRS:H$)zConvert choices to a bool.r)rdlowerr1rrjres rrmConfirm.process_responseTsB ##%  $!$"="=> > Q''rrN)rrrrrrr0rjr1rr<r~rrrMrmrrrrrrBsOMBsGT#Y#RkRdR (c(d(rr__main__)rqzRun [i]prompt[/i] tests?T)r@z6:rocket: Enter a number between [b]1[/b] and [b]10[/b] z=:pile_of_poo: [prompt.invalid]Number must be between 1 and 10znumber=z=Please enter a password [cyan](must be at least 5 characters))r4z"[prompt.invalid]password too shortz password=z Enter a fruit)appleorangepear)r1zfruit=z[b]OK :loudly_crying_face:N)%typingrrrrrrr r rPr r3r textrrrr Exceptionrrr.r<rrrrrrrpip._vendor.richrqrCresultr4lenfruitrrrrsQQQ \ " m$ :): k }$$}$@ Z_  S 3 S E*S/ E(j(4 z&{{-t{<]]HRS#F{v| Q R  x !zzO"H8}! 6 7  (&' ?4O P ui ! *+9r