
    AHjb                         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 d dlmZ  G d de      Z	d	ed
dfdZ
 G d d      Zy)    )Any)Dict)
NamedTuple)Sequence)DEFAULT_KBI_MESSAGE)Questionc                   &    e Zd ZU dZeed<   eed<   y)	FormFieldz
    Represents a question within a form

    Args:
        key: The name of the form field.
        question: The question to ask in the form field.
    keyquestionN)__name__
__module____qualname____doc__str__annotations__r        H/root/tools/cai/cai_env/lib/python3.12/site-packages/questionary/form.pyr
   r
   
   s     
Hr   r
   kwargsreturnFormc                  <    t        d | j                         D         S )zCreate a form with multiple questions.

    The parameter name of a question will be the key for the answer in
    the returned dict.

    Args:
        kwargs: Questions to ask in the form.
    c              3   :   K   | ]  \  }}t        ||        y wN)r
   ).0kqs      r   	<genexpr>zform.<locals>.<genexpr>    s     =da)Aq/=s   )r   items)r   s    r   formr!      s     =flln=>>r   c            	           e Zd ZU dZee   ed<   deddfdZddede	e
ef   fdZddede	e
ef   fd	Zdefded
e
de	e
ef   fdZdefded
e
de	e
ef   fdZy)r   zMulti question prompts. Questions are asked one after another.

    All the answers are returned as a dict with one entry per question.

    This class should not be invoked directly, instead use :func:`form`.
    form_fieldsr   Nc                     || _         y r   )r#   )selfr#   s     r   __init__zForm.__init__-   s
    &r   Fpatch_stdoutc                     | j                   D ci c](  }|j                  |j                  j                  |      * c}S c c}w )a=  Ask the questions synchronously and return user response.

        Does not catch keyboard interrupts.

        Args:
            patch_stdout: Ensure that the prompt renders correctly if other threads
                          are printing to stdout.

        Returns:
            The answers from the form.
        )r#   r   r   
unsafe_askr%   r'   fs      r   r)   zForm.unsafe_ask0   s8     EIDTDTUqqzz,,\::UUUs   -?c                    K   | j                   D ci c]0  }|j                  |j                  j                  |       d{   2 c}S 7 	c c}w w)a=  Ask the questions using asyncio and return user response.

        Does not catch keyboard interrupts.

        Args:
            patch_stdout: Ensure that the prompt renders correctly if other threads
                          are printing to stdout.

        Returns:
            The answers from the form.
        N)r#   r   r   unsafe_ask_asyncr*   s      r   r-   zForm.unsafe_ask_async>   sL      %%
 EE44\BBB
 	
B
s'   A.AA	 AA	AAkbi_msgc                 ^    	 | j                  |      S # t        $ r t        |       i cY S w xY w)aY  Ask the questions synchronously and return user response.

        Args:
            patch_stdout: Ensure that the prompt renders correctly if other threads
                          are printing to stdout.

            kbi_msg: The message to be printed on a keyboard interrupt.

        Returns:
            The answers from the form.
        )r)   KeyboardInterruptprintr%   r'   r.   s      r   askzForm.askO   s1    	??<00  	'NI	s    ,,c                 z   K   	 | j                  |       d{   S 7 # t        $ r t        |       i cY S w xY ww)aY  Ask the questions using asyncio and return user response.

        Args:
            patch_stdout: Ensure that the prompt renders correctly if other threads
                          are printing to stdout.

            kbi_msg: The message to be printed on a keyboard interrupt.

        Returns:
            The answers from the form.
        N)r-   r0   r1   r2   s      r   	ask_asynczForm.ask_asyncc   s<     	..|<<<<  	'NI	s(   ;  ; 8;8;)F)r   r   r   r   r   r
   r   r&   boolr   r   r   r)   r-   r   r3   r5   r   r   r   r   r   #   s     )$$'Y '4 'Vt VS#X V
4 
DcN 
$ $)9L 36	c3h* $)9L 36	c3hr   N)typingr   r   r   r   questionary.constantsr   questionary.questionr   r
   r!   r   r   r   r   <module>r:      sB        5 )

 
	?8 	? 	?R Rr   