
    F dbF                     D   U d dl Z d dlZd dl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
 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edej        eej        f         dedededefdZ G d d          ZdZdZdZ G d d          Z G d de          Z G d de          Z G d d e          Zeeed!Zej        eej         e         f         e!d"<   	 d2d#ej         e         d$ej"        e         ddfd%Z#d&edej"        ej         e                  fd'Z$d(e	d)ede%fd*Z&d(e	d+ede%fd,Z'd(e	d-ej(        e         d)ede%fd.Z)dedej        eej        f         ded-ej(        e         de	f
d/Z*d(e	d-ej(        e         d0edej+        ej,        eef         ef         fd1Z-dS )3    N)gettext   )Argument)BaseCommand)Context)MultiCommand)Option)	Parameter)ParameterSource)split_arg_string)echoclictx_args	prog_namecomplete_varinstructionreturnc                    |                     d          \  }}}t          |          }|dS  || |||          }|dk    r#t          |                                           dS |dk    r#t          |                                           dS dS )a   Perform shell completion for the given CLI program.

    :param cli: Command being called.
    :param ctx_args: Extra arguments to pass to
        ``cli.make_context``.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.
    :param instruction: Value of ``complete_var`` with the completion
        instruction and shell, in the form ``instruction_shell``.
    :return: Status code to exit with.
    _Nr   sourcer   complete)	partitionget_completion_classr   r   r   )	r   r   r   r   r   shellr   comp_clscomps	            _C:\Users\ChattiNader\Documents\MyHotelMatch\api\dev\Lib\site-packages\click/shell_completion.pyshell_completer      s    & (11#66E1k#E**Hq8C9l;;DhT[[]]qj  T]]__q1    c                   |    e Zd ZdZdZ	 	 ddej        dedej        e         dej        d	df
d
Z	ded	ej        fdZ
dS )CompletionItema)  Represents a completion value and metadata about the value. The
    default metadata is ``type`` to indicate special shell handling,
    and ``help`` if a shell supports showing a help string next to the
    value.

    Arbitrary parameters can be passed when creating the object, and
    accessed using ``item.attr``. If an attribute wasn't passed,
    accessing it returns ``None``.

    :param value: The completion suggestion.
    :param type: Tells the shell script to provide special completion
        support for the type. Click uses ``"dir"`` and ``"file"``.
    :param help: String shown next to the value if supported.
    :param kwargs: Arbitrary metadata. The built-in implementations
        don't use this, but custom type completions paired with custom
        shell support could use it.
    valuetypehelp_infoplainNr#   r$   r%   kwargsr   c                 >    || _         || _        || _        || _        d S Nr"   )selfr#   r$   r%   r(   s        r   __init__zCompletionItem.__init__L   s$     
		


r   namec                 6    | j                             |          S r*   )r&   get)r+   r-   s     r   __getattr__zCompletionItem.__getattr__X   s    z~~d###r   )r'   N)__name__
__module____qualname____doc__	__slots__tAnystrOptionalr,   r0    r   r   r!   r!   7   s         $ 3I
  $	
 
u
 
 jo	

 %
 

 
 
 
$ $ $ $ $ $ $ $r   r!   a  %(complete_func)s() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD %(complete_var)s=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            COMPREPLY=()
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            COMPREPLY=()
            compopt -o default
        elif [[ $type == 'plain' ]]; then
            COMPREPLY+=($value)
        fi
    done

    return 0
}

%(complete_func)s_setup() {
    complete -o nosort -F %(complete_func)s %(prog_name)s
}

%(complete_func)s_setup;
a  #compdef %(prog_name)s

%(complete_func)s() {
    local -a completions
    local -a completions_with_descriptions
    local -a response
    (( ! $+commands[%(prog_name)s] )) && return 1

    response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) %(complete_var)s=zsh_complete %(prog_name)s)}")

    for type key descr in ${response}; do
        if [[ "$type" == "plain" ]]; then
            if [[ "$descr" == "_" ]]; then
                completions+=("$key")
            else
                completions_with_descriptions+=("$key":"$descr")
            fi
        elif [[ "$type" == "dir" ]]; then
            _path_files -/
        elif [[ "$type" == "file" ]]; then
            _path_files -f
        fi
    done

    if [ -n "$completions_with_descriptions" ]; then
        _describe -V unsorted completions_with_descriptions -U
    fi

    if [ -n "$completions" ]; then
        compadd -U -V unsorted -a completions
    fi
}

compdef %(complete_func)s %(prog_name)s;
a  function %(complete_func)s;
    set -l response;

    for value in (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(prog_name)s);
        set response $response $value;
    end;

    for completion in $response;
        set -l metadata (string split "," $completion);

        if test $metadata[1] = "dir";
            __fish_complete_directories $metadata[2];
        else if test $metadata[1] = "file";
            __fish_complete_path $metadata[2];
        else if test $metadata[1] = "plain";
            echo $metadata[2];
        end;
    end;
end;

complete --no-files --command %(prog_name)s --arguments "(%(complete_func)s)";
c            
          e Zd ZU dZej        e         ed<   	 ej        e         ed<   	 dedej	        eej
        f         dededd	f
d
Zedefd            Zdej	        eej
        f         fdZdefdZdej        ej        e         ef         fdZdej        e         dedej        e         fdZdedefdZdefdZd	S )ShellCompletea  Base class for providing shell completion support. A subclass for
    a given shell will override attributes and methods to implement the
    completion instructions (``source`` and ``complete``).

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param complete_var: Name of the environment variable that holds
        the completion instruction.

    .. versionadded:: 8.0
    r-   source_templater   r   r   r   r   Nc                 >    || _         || _        || _        || _        d S r*   )r   r   r   r   )r+   r   r   r   r   s        r   r,   zShellComplete.__init__   s'      "(r   c                     t          j        dd| j                            dd          t           j                  }d| dS )zQThe name of the shell function defined by the completion
        script.
        z\W* -r   _completion)resubr   replaceASCII)r+   	safe_names     r   	func_namezShellComplete.func_name   s>    
 F62t~'='=c3'G'GRR	)9))))r   c                 ,    | j         | j        | j        dS )zVars for formatting :attr:`source_template`.

        By default this provides ``complete_func``, ``complete_var``,
        and ``prog_name``.
        )complete_funcr   r   )rH   r   r   r+   s    r   source_varszShellComplete.source_vars   s#     "^ -
 
 	
r   c                 :    | j         |                                 z  S )zProduce the shell script that defines the completion
        function. By default this ``%``-style formats
        :attr:`source_template` with the dict returned by
        :meth:`source_vars`.
        )r=   rL   rK   s    r   r   zShellComplete.source   s     #d&6&6&8&888r   c                     t           )zUse the env vars defined by the shell script to return a
        tuple of ``args, incomplete``. This must be implemented by
        subclasses.
        NotImplementedErrorrK   s    r   get_completion_argsz!ShellComplete.get_completion_args   s
    
 "!r   args
incompletec                     t          | j        | j        | j        |          }t	          |||          \  }}|                    ||          S )aT  Determine the context and last complete command or parameter
        from the complete args. Call that object's ``shell_complete``
        method to get the completions for the incomplete value.

        :param args: List of complete args before the incomplete value.
        :param incomplete: Value being completed. May be empty.
        )_resolve_contextr   r   r   _resolve_incompleter   )r+   rR   rS   ctxobjs        r   get_completionszShellComplete.get_completions  sH     txMM-c4DDZ!!#z222r   itemc                     t           )zFormat a completion item into the form recognized by the
        shell script. This must be implemented by subclasses.

        :param item: Completion item to format.
        rO   r+   rZ   s     r   format_completionzShellComplete.format_completion  s
     "!r   c                                                        \  }}                     ||          } fd|D             }d                    |          S )zProduce the completion data to send back to the shell.

        By default this calls :meth:`get_completion_args`, gets the
        completions, then calls :meth:`format_completion` for each
        completion.
        c                 :    g | ]}                     |          S r:   )r]   ).0rZ   r+   s     r   
<listcomp>z*ShellComplete.complete.<locals>.<listcomp>$  s'    DDDt%%d++DDDr   
)rQ   rY   join)r+   rR   rS   completionsouts   `    r   r   zShellComplete.complete  sY      3355j**4<<DDDDDDDyy~~r   )r1   r2   r3   r4   r6   ClassVarr8   __annotations__r   Dictr7   r,   propertyrH   rL   r   TupleListrQ   r!   rY   r]   r   r:   r   r   r<   r<      s        
 
 *S/
 Z_$$$
)
) &ae$
) 	
)
 
) 

) 
) 
) 
) *3 * * * X*

QVCJ/ 

 

 

 

9 9 9 9 9"QWQVC[#-=%> " " " "3F3K3-03	
	3 3 3 3"n " " " " "
# 
 
 
 
 
 
r   r<   c                        e Zd ZdZdZeZd
dZdef fdZ	de
j        e
j        e         ef         fdZdedefd	Z xZS )BashCompletezShell completion for Bash.bashr   Nc                 l   dd l }|                    g d|j                  }t          j        d|j                                                  }|I|                                \  }}|dk     s|dk    r"|dk     rt          t          d                    d S d S t          t          d                    )Nr   )rn   z-czecho ${BASH_VERSION})stdoutz^(\d+)\.(\d+)\.\d+4zCShell completion is not supported for Bash versions older than 4.4.z@Couldn't detect Bash version, shell completion is not supported.)

subprocessrunPIPErC   searchrp   decodegroupsRuntimeErrorr   )r+   rr   outputmatchmajorminors         r   _check_versionzBashComplete._check_version.  s    222:?   
 
 	/1E1E1G1GHH <<>>LE5s{{esllus{{"4    +l{{ TUU  r   c                 l    |                                   t                                                      S r*   )r}   superr   )r+   	__class__s    r   r   zBashComplete.sourceE  s)    ww~~r   c                     t          t          j        d                   }t          t          j        d                   }|d|         }	 ||         }n# t          $ r d}Y nw xY w||fS N
COMP_WORDS
COMP_CWORDr   r@   r   osenvironint
IndexErrorr+   cwordscwordrR   rS   s        r   rQ   z BashComplete.get_completion_argsI  x    !"*\":;;BJ|,--ag	JJ 	 	 	JJJ	 Z   
A A"!A"rZ   c                 $    |j          d|j         S )N,)r$   r#   r\   s     r   r]   zBashComplete.format_completionU  s    )**dj***r   )r   N)r1   r2   r3   r4   r-   _SOURCE_BASHr=   r}   r8   r   r6   rj   rk   rQ   r!   r]   __classcell__)r   s   @r   rm   rm   (  s        $$D"O   .             
 QWQVC[#-=%> 
  
  
  
 +n + + + + + + + + +r   rm   c                   f    e Zd ZdZdZeZdej        ej	        e
         e
f         fdZdede
fdZdS )ZshCompletezShell completion for Zsh.zshr   c                     t          t          j        d                   }t          t          j        d                   }|d|         }	 ||         }n# t          $ r d}Y nw xY w||fS r   r   r   s        r   rQ   zZshComplete.get_completion_args_  r   r   rZ   c                 F    |j          d|j         d|j        r|j        nd S )Nrb   r   )r$   r#   r%   r\   s     r   r]   zZshComplete.format_completionk  s/    )NNtzNN$)-LTYYNNNr   N)r1   r2   r3   r4   r-   _SOURCE_ZSHr=   r6   rj   rk   r8   rQ   r!   r]   r:   r   r   r   r   Y  s{        ##D!O
 QWQVC[#-=%> 
  
  
  
 On O O O O O O Or   r   c                   f    e Zd ZdZdZeZdej        ej	        e
         e
f         fdZdede
fdZdS )FishCompletezShell completion for Fish.fishr   c                     t          t          j        d                   }t          j        d         }|dd          }|r"|r |d         |k    r|                                 ||fS )Nr   r   r   )r   r   r   pop)r+   r   rS   rR   s       r   rQ   z FishComplete.get_completion_argsu  sf    !"*\":;;Z-
abbz  	$ 	48z#9#9HHJJJZr   rZ   c                 d    |j         r|j         d|j         d|j          S |j         d|j         S )Nr   	)r%   r$   r#   r\   s     r   r]   zFishComplete.format_completion  sF    9 	<i;;$*;;	;;;)**dj***r   N)r1   r2   r3   r4   r-   _SOURCE_FISHr=   r6   rj   rk   r8   rQ   r!   r]   r:   r   r   r   r   o  ss        $$D"O
 QWQVC[#-=%> 
  
  
  
 +n + + + + + + +r   r   )rn   r   r   _available_shellsclsr-   c                 ,    || j         }| t          |<   dS )am  Register a :class:`ShellComplete` subclass under the given name.
    The name will be provided by the completion instruction environment
    variable during completion.

    :param cls: The completion class that will handle completion for the
        shell.
    :param name: Name to register the class under. Defaults to the
        class's ``name`` attribute.
    N)r-   r   )r   r-   s     r   add_completion_classr     s!     |x!dr   r   c                 6    t                               |           S )zLook up a registered :class:`ShellComplete` subclass by the name
    provided by the completion instruction environment variable. If the
    name isn't registered, returns ``None``.

    :param shell: Name the class is registered under.
    )r   r/   )r   s    r   r   r     s       '''r   rW   paramc                 F   t          |t                    sdS |j        J | j        |j                 }|j        dk    pd|                     |j                  t          j        up>|j        dk    o3t          |t          t          f          ot          |          |j        k     S )zDetermine if the given parameter is an argument that can still
    accept values.

    :param ctx: Invocation context for the command represented by the
        parsed complete args.
    :param param: Argument object being checked.
    FNr   r   )
isinstancer   r-   paramsnargsget_parameter_sourcer   COMMANDLINEtuplelistlen)rW   r   r#   s      r   _is_incomplete_argumentr     s     eX&& u:!!!Juz"Er 	
##EJ//7RR	
 K!O )55$-00)E

U[(r   r#   c                 ,    |sdS |d         }|| j         v S )z5Check if the value looks like the start of an option.Fr   )_opt_prefixes)rW   r#   cs      r   _start_of_optionr     s&     uaA!!!r   rR   c                     t          |t                    sdS |j        s|j        rdS d}t	          t          |                    D ]'\  }}|dz   |j        k    r nt          | |          r|}(|duo||j        v S )zDetermine if the given parameter is an option that needs a value.

    :param args: List of complete args before the incomplete value.
    :param param: Option object being checked.
    FNr   )	r   r	   is_flagcount	enumeratereversedr   r   opts)rW   rR   r   last_optionindexargs         r   _is_incomplete_optionr     s     eV$$ u}  uK//  
s19u{""EC%% 	Kd"@{ej'@@r   c                    d|d<    | j         ||                                fi |}|j        |j        z   }|r|j        }t          |t                    r|j        sG|                    ||          \  }}}||S |                     |||d          }|j        |j        z   }nX|rB|                    ||          \  }}}||S |                     |||ddd          }|j        }|B|}g |j        |j        }nn||S )a`  Produce the context hierarchy starting with the command and
    traversing the complete arguments. This only follows the commands,
    it doesn't trigger input prompts or callbacks.

    :param cli: Command being called.
    :param prog_name: Name of the executable in the shell.
    :param args: List of complete args before the incomplete value.
    Tresilient_parsingN)parentr   F)r   allow_extra_argsallow_interspersed_argsr   )	make_contextcopyprotected_argsrR   commandr   r   chainresolve_command)	r   r   r   rR   rW   r   r-   cmdsub_ctxs	            r   rU   rU     s`    %)H !
#
9diikk
>
>X
>
>C(D
  +g|,, 	= @")"9"9#t"D"Dc4;J&&tT#QU&VV)CH4 (&-&=&=c4&H&HOD#t{"
!..")-05*. /  G #<D  (  ?/?',?A   D Jr   rS   c                    |dk    rd}nBd|v r>t          | |          r.|                    d          \  }}}|                    |           d|vrt          | |          r	| j        |fS | j                            |           }|D ]}t          | ||          r||fc S |D ]}t          | |          r||fc S | j        |fS )ah  Find the Click object that will handle the completion of the
    incomplete value. Return the object and the incomplete value.

    :param ctx: Invocation context for the command represented by
        the parsed complete args.
    :param args: List of complete args before the incomplete value.
    :param incomplete: Value being completed. May be empty.
    =r@   z--)r   r   appendr   
get_paramsr   r   )rW   rR   rS   r-   r   r   r   s          r   rV   rV     s    S

	
		/Z@@	(22377aD 4,S*=={J&&[##C((F  % % dE22 	%*$$$$	%
  % %"3.. 	%*$$$$	%
 ;
""r   r*   ).r   rC   typingr6   r   r   corer   r   r   r   r	   r
   r   parserr   utilsr   rh   r8   r7   r   r   r!   r   r   r   r<   rm   r   r   r   Typerg   r9   r   r   boolr   r   rk   r   rU   rj   UnionrV   r:   r   r   <module>r      s   					 				                                                     ! ! ! ! ! ! $ $ $ $ $ $      #	#fS!%Z # # 	#
 # 	# # # #L"$ "$ "$ "$ "$ "$ "$ "$L@$L6g g g g g g g gT.+ .+ .+ .+ .+= .+ .+ .+bO O O O O- O O O,+ + + + += + + +4 9 9 16#qvm445    9=" "	
	"&'jo"	" " " "$( (
16-3H(I ( ( ( (  t    0"' "# "$ " " " "Aw AafSk A) APT A A A A01	1 !sAEz 21?B1JK&QT+11 1 1 1h,#	,#s,#14,#WQW[)+,c12,# ,# ,# ,# ,# ,#r   