
Ebc           @   sj  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 y d  d	 l m Z Wn e k
 r d  d l Z n Xd
 Z d Z d Z d Z i e d 6e d 6e d 6Z e j d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d S(   iNi   (   t   Argument(   t   MultiCommand(   t   Option(   t   split_arg_string(   t   Choice(   t   echo(   t   abct   =s  
%(complete_func)s() {
    local IFS=$'
'
    COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                   COMP_CWORD=$COMP_CWORD \
                   %(autocomplete_var)s=complete $1 ) )
    return 0
}

%(complete_func)setup() {
    local COMPLETION_OPTIONS=""
    local BASH_VERSION_ARR=(${BASH_VERSION//./ })
    # Only BASH version 4.4 and later have the nosort option.
    if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then
        COMPLETION_OPTIONS="-o nosort"
    fi

    complete $COMPLETION_OPTIONS -F %(complete_func)s %(script_names)s
}

%(complete_func)setup
s  
#compdef %(script_names)s

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

    response=("${(@f)$( env COMP_WORDS="${words[*]}" \
                        COMP_CWORD=$((CURRENT-1)) \
                        %(autocomplete_var)s="complete_zsh" \
                        %(script_names)s )}")

    for key descr in ${(kv)response}; do
      if [[ "$descr" == "_" ]]; then
          completions+=("$key")
      else
          completions_with_descriptions+=("$key":"$descr")
      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
    compstate[insert]="automenu"
}

compdef %(complete_func)s %(script_names)s
s   complete --no-files --command %(script_names)s --arguments "(env %(autocomplete_var)s=complete_fish COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) %(script_names)s)"t   basht   zsht   fishs   [^a-zA-Z0-9_]c         C   s`   t  j d |  j d d   } t j | t  } | i d j |  d 6|  d 6| d 6j   d S(	   Nt    t   -t   _s   _{}_completiont   complete_funct   script_namest   autocomplete_vart   ;(   t   _invalid_ident_char_ret   subt   replacet   _completion_scriptst   gett   COMPLETION_SCRIPT_BASHt   formatt   strip(   t	   prog_namet   complete_vart   shellt   cf_namet   script(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   get_completion_script_   s    c         C   s>  |  j  | | d t } | j | j } x| r9t | j t  r5| j j s | j j | |  \ } } } | d k r} | S| j  | | d | d t } | j | j } q6xk | r| j j | |  \ } } } | d k r | S| j  | | d | d t d t
 d t } | j } q W| } | j | j } q+ Pq+ W| S(   s  Parse into a hierarchy of contexts. Contexts are connected
    through the parent variable.

    :param cli: command definition
    :param prog_name: the program that is running
    :param args: full list of args
    :return: the final context/command parsed
    t   resilient_parsingt   parentt   allow_extra_argst   allow_interspersed_argsN(   t   make_contextt   Truet   protected_argst   argst
   isinstancet   commandR   t   chaint   resolve_commandt   Nonet   False(   t   cliR   R'   t   ctxt   cmd_namet   cmdt   sub_ctx(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   resolve_ctxl   s6    				c         C   s   |  o |  d  d k S(   s   
    :param param_str: param_str to check
    :return: whether or not this is the start of an option declaration
        (i.e. starts "-" or "--")
    i   R   (    (   t	   param_str(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   start_of_option   s    c         C   s   t  | t  s t S| j r  t Sd } xk t t g  |  D] } | t k r6 | ^ q6   D]8 \ } } | d | j k r{ Pn  t	 |  rX | } qX qX W| r | | j
 k r t St S(   sU  
    :param all_args: the full original list of args supplied
    :param cmd_param: the current command paramter
    :return: whether or not the last option declaration (i.e. starts
        "-" or "--") is incomplete and corresponds to this cmd_param. In
        other words whether this cmd_param option can still accept
        values
    i   N(   R(   R   R-   t   is_flagR,   t	   enumeratet   reversedt	   WORDBREAKt   nargsR5   t   optsR%   (   t   all_argst	   cmd_paramt   last_optiont   argt   indext   arg_str(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   is_incomplete_option   s    		8c         C   s   t  | t  s t S|  | j } | d k r0 t S| j d k rC t St  | t j  r} | j d k r} t	 |  | j k  r} t St S(   s`  
    :param current_params: the current params and values for this
        argument as already entered
    :param cmd_param: the current command parameter
    :return: whether or not the last argument is incomplete and
        corresponds to this cmd_param. In other words whether or not the
        this cmd_param argument can still accept values
    ii   N(
   R(   R    R-   t   nameR,   R%   R:   R   t   Iterablet   len(   t   current_paramsR=   t   current_param_values(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   is_incomplete_argument   s    	c         C   s   g  } t  | j t  rU g  | j j D]' } t |  j |  r% | d f ^ q% } nd | j d k	 r | j d |  d | d |  } g  | D]' } t  | t  r | n	 | d f ^ q } n  | S(   s  
    :param ctx: context associated with the parsed command
    :param args: full list of args
    :param incomplete: the incomplete text to autocomplete
    :param cmd_param: command definition
    :return: all the possible user-specified completions for the param
    R/   R'   t
   incompleteN(	   R(   t   typeR   t   choicest   strt
   startswithR,   t   autocompletiont   tuple(   R/   R'   RI   R=   t   resultst   ct   dynamic_completions(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   get_user_autocompletions   s    =	7c         c   sY   xR |  j  j |   D]> } | j |  r |  j  j |  |  } | j sQ | VqQ q q Wd S(   s   
    :param ctx: context associated with the parsed command
    :starts_with: string that visible commands must start with.
    :return: all visible (not hidden) commands that start with starts_with.
    N(   R)   t   list_commandsRM   t   get_commandt   hidden(   R/   t   starts_withRQ   R)   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt"   get_visible_commands_starting_with   s
    	c         C   s   t  |  j t  rM | j g  t |  |  D] } | j | j   f ^ q(  n  x |  j d  k	 r |  j }  t  |  j t  rP |  j j	 rP g  t |  |  D] } | j |  j
 k r | ^ q } | j g  | D] } | j | j   f ^ q  qP qP Wd  S(   N(   R(   R)   R   t   extendRX   RC   t   get_short_help_strR!   R,   R*   R&   (   R/   RI   t   completions_outRQ   t   remaining_commands(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   add_subcommand_completions   s    2	c         C   s  t  j |  } t |  | |  } | d k r1 g  Sd | k } t |  r t | k r | j t  } | j | d  | d } n | t k r d } n  g  } | rWt |  rWx | j j	 D] }	 t
 |	 t  r |	 j r g  |	 j |	 j D]! }
 |
 | k s|	 j r |
 ^ q } | j g  | D]$ } | j |  r!| |	 j f ^ q! q q W| Sx6 | j j	 D]( }	 t | |	  rdt | | | |	  SqdWx9 | j j	 D]+ }	 t | j	 |	  rt | | | |	  SqWt | | |  t |  S(   s   
    :param cli: command definition
    :param prog_name: the program that is running
    :param args: full list of args
    :param incomplete: the incomplete text to autocomplete
    :return: all the possible completions for the incomplete
    s   --i    i   R   N(   t   copyt   deepcopyR3   R,   R5   R9   t	   partitiont   appendR)   t   paramsR(   R   RV   R;   t   secondary_optst   multipleRY   RM   t   helpRB   RS   RH   R]   t   sorted(   R.   R   R'   RI   R<   R/   t   has_double_dasht   partition_incompletet   completionst   paramt	   param_optt
   param_optst   o(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   get_choices  s:    	!9c         C   s   t  t j d  } t t j d  } | d | !} y | | } Wn t k
 rZ d } n XxR t |  | | |  D]; } t | d  | rq t | d r | d n d  qq qq Wt S(   Nt
   COMP_WORDSt
   COMP_CWORDi   R   i    R   (   R   t   ost   environt   intt
   IndexErrorRn   R   R%   (   R.   R   t   include_descriptionst   cwordst   cwordR'   RI   t   item(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   do_completeE  s    
%c         C   s   t  t j d  } t j d } | d } x\ t |  | | |  D]E } | d rw t d j d | d d | d   q@ t | d  q@ Wt S(   NRo   Rp   i   s   {arg}	{desc}R?   i    t   desc(   R   Rq   Rr   Rn   R   R   R%   (   R.   R   Rv   RI   R'   Rx   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   do_complete_fishY  s    

'c         C   s   d | k r' | j  d d  \ } } n | } d } | d k rY t t | | |   t S| d k r | d k r~ t |  |  S| d d h k r t |  | | d k  Sn  t S(   NR   i   R   t   sourcet   completeR
   R	   (   t   splitR   R   R%   R{   Ry   R-   (   R.   R   R   t   complete_instrR)   R   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   bashcompleteg  s    (#   R^   Rq   t   ret   coreR    R   R   t   parserR   t   typesR   t   utilsR   t   collectionsR   t   ImportErrorR9   R   t   COMPLETION_SCRIPT_ZSHt   COMPLETION_SCRIPT_FISHR   t   compileR   R   R3   R5   RB   RH   RS   RX   R]   Rn   Ry   R{   R   (    (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/click/_bashcomplete.pyt   <module>   sB   #
		+								5		