ó
{Udc           @@  s-  d  Z  d d l m Z d d l Z 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 m Z d d	 l m Z d d
 l m Z e j e ƒ Z d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   s   Base option parser setupi    (   t   absolute_importN(   t	   strtobool(   t   suppress(   t   string_types(   t   UNKNOWN_ERROR(   t   Configurationt   ConfigurationError(   t   get_terminal_size(   t   redact_auth_from_urlt   PrettyHelpFormatterc           B@  s\   e  Z d  Z d „  Z d „  Z d d d „ Z d „  Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 RS(   s4   A prettier/less verbose help formatter for optparse.c         O@  sC   d | d <d | d <t  ƒ  d d | d <t j j |  | | Ž d  S(   Ni   t   max_help_positioni   t   indent_incrementi    i   t   width(   R   t   optparset   IndentedHelpFormattert   __init__(   t   selft   argst   kwargs(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR      s    

c         C@  s   |  j  | ƒ S(   N(   t   _format_option_strings(   R   t   option(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   format_option_strings#   s    s    <{}>s   , c         C@  s»   g  } | j  r& | j | j  d ƒ n  | j rF | j | j d ƒ n  t | ƒ d k rk | j d | ƒ n  | j ƒ  r® | j pŒ | j j ƒ  } | j | j	 | j ƒ  ƒ ƒ n  d j
 | ƒ S(   sð   
        Return a comma-separated list of option strings and metavars.

        :param option:  tuple of (short opt, long opt), e.g: ('-f', '--format')
        :param mvarfmt: metavar format string
        :param optsep:  separator
        i    i   t    (   t   _short_optst   appendt
   _long_optst   lent   insertt   takes_valuet   metavart   destt   lowert   formatt   join(   R   R   t   mvarfmtt   optsept   optsR   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR   &   s    		c         C@  s   | d k r d S| d S(   Nt   OptionsR   s   :
(    (   R   t   heading(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   format_heading=   s    c         C@  s(   d j  |  j t j | ƒ d ƒ ƒ } | S(   sz   
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        s   
Usage: {}
s     (   R    t   indent_linest   textwrapt   dedent(   R   t   usaget   msg(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   format_usageB   s    c         C@  s{   | rs t  |  j d ƒ r! d } n d } | j d ƒ } | j ƒ  } |  j t j | ƒ d ƒ } d j | | ƒ } | Sd Sd  S(   Nt   maint   Commandst   Descriptions   
s     s   {}:
{}
R   (   t   hasattrt   parsert   lstript   rstripR(   R)   R*   R    (   R   t   descriptiont   label(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   format_descriptionK   s    	c         C@  s   | r
 | Sd Sd  S(   NR   (    (   R   t   epilog(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   format_epilog]   s    c         C@  s3   g  | j  d ƒ D] } | | ^ q } d j | ƒ S(   Ns   
(   t   splitR!   (   R   t   textt   indentt   linet	   new_lines(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR(   d   s    &(   t   __name__t
   __module__t   __doc__R   R   R   R'   R-   R7   R9   R(   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR	      s   							t   UpdatingDefaultsHelpFormatterc           B@  s   e  Z d  Z d „  Z RS(   sÚ   Custom help formatter for use in ConfigOptionParser.

    This is updates the defaults before expanding them, allowing
    them to show up correctly in the help listing.

    Also redact auth from url type options
    c         C@  sÓ   d  } |  j d  k	 rF |  j j |  j j ƒ |  j j j | j ƒ } n  t j j |  | ƒ } | rÏ | j	 d k rÏ t
 | t ƒ r‹ | g } n  t
 | t ƒ s£ g  } n  x) | D] } | j | t | ƒ ƒ } qª Wn  | S(   Nt   URL(   t   NoneR2   t   _update_defaultst   defaultst   getR   R   R   t   expand_defaultR   t
   isinstanceR   t   listt   replaceR   (   R   R   t   default_valuest	   help_textt   val(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyRH   r   s    	(   R?   R@   RA   RH   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyRB   i   s   t   CustomOptionParserc           B@  s    e  Z d  „  Z e d „  ƒ Z RS(   c         O@  s6   |  j  | | Ž  } |  j j ƒ  |  j j | | ƒ | S(   s*   Insert an OptionGroup at a given position.(   t   add_option_groupt   option_groupst   popR   (   R   t   idxR   R   t   group(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   insert_option_groupŠ   s    c         C@  s2   |  j  } x! |  j D] } | j | j  ƒ q W| S(   s<   Get a list of all options, including those in option groups.(   t   option_listRQ   t   extend(   R   t   rest   i(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   option_list_all“   s    
(   R?   R@   RU   t   propertyRZ   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyRO   ˆ   s   		t   ConfigOptionParserc           B@  sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   ss   Custom option parser which updates its defaults by checking the
    configuration files and environmental variablesc         O@  s\   | j  d ƒ |  _ | j  d t ƒ } t | ƒ |  _ |  j sB t ‚ t j j |  | | Ž d  S(   Nt   namet   isolated(	   RR   R]   t   FalseR   t   configt   AssertionErrorR   t   OptionParserR   (   R   R   R   R^   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR   ¡   s
    c         C@  sL   y | j  | | ƒ SWn1 t j k
 rG } d j | ƒ GHt j d ƒ n Xd  S(   Ns*   An error occurred during configuration: {}i   (   t   check_valueR   t   OptionValueErrorR    t   syst   exit(   R   R   t   keyRN   t   exc(    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   check_defaultª   s
    c         c@  s×   d |  j  d g } d „  | Dƒ } xw |  j j ƒ  D]f \ } } | sZ t j d | ƒ q2 n  | j d d ƒ \ } } | | k r2 | | j | | f ƒ q2 q2 Wx4 | D], } x# | | D] \ } } | | f Vq´ Wq£ Wd  S(   Nt   globals   :env:c         S@  s   i  |  ] } g  | “ q S(    (    (   t   .0R]   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pys
   <dictcomp>¶   s   	 s7   Ignoring configuration key '%s' as it's value is empty.t   .i   (   R]   R`   t   itemst   loggert   debugR:   R   (   R   t   override_ordert   section_itemst   section_keyRN   t   sectionRg   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt    _get_ordered_configuration_items±   s    c   
      C@  sM  t  j |  j ƒ |  _ t ƒ  } xø|  j ƒ  D]ê\ } } |  j d | ƒ } | d k r\ q+ n  | j d k r« y t	 | ƒ } Wqt
 k
 r§ |  j d j | | ƒ ƒ qXn]| j d k r3t t
 ƒ  t	 | ƒ } Wd QXt t
 ƒ  t | ƒ } Wd QXt | t ƒ s| d k  r|  j d j | | ƒ ƒ qnÕ | j d	 k ry| j ƒ  } g  | D] } |  j | | | ƒ ^ qU} n | j d
 k ró| j | j ƒ | j ƒ  } | j | | ƒ } | j pÂd } | j pÑi  }	 | j | | | |  | |	 Ž n |  j | | | ƒ } | | | j <q+ Wx$ | D] } t |  j | ƒ | | <q Wd |  _ | S(   s¢   Updates the given defaults with values from the config files and
        the environ. Does a little special handling for certain types of
        options (lists).s   --t
   store_truet   store_falsesm   {} is not a valid value for {} option, please specify a boolean value like yes/no, true/false or 1/0 instead.t   countNi    s¤   {} is not a valid value for {} option, please instead specify either a non-negative integer or a boolean value like yes/no or false/true which is equivalent to 1/0.R   t   callback(   Ru   Rv   (    (   R   t   ValuesRF   t   valuest   setRt   t
   get_optionRD   t   actionR   t
   ValueErrort   errorR    R   t   intRI   R:   Ri   t   addR   t   get_opt_stringt   convert_valuet   callback_argst   callback_kwargsRx   t   getattr(
   R   RF   t	   late_evalRg   RN   R   t   vt   opt_strR   R   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyRE   É   sL    	+	c         C@  sÛ   |  j  s t j |  j ƒ Sy |  j j ƒ  Wn) t k
 rU } |  j t t	 | ƒ ƒ n X|  j
 |  j j ƒ  ƒ } x] |  j ƒ  D]O } | j | j ƒ } t | t ƒ r{ | j ƒ  } | j | | ƒ | | j <q{ q{ Wt j | ƒ S(   s‹   Overriding to make updating the defaults after instantiation of
        the option parser possible, _update_defaults() does the dirty work.(   t   process_default_valuesR   Ry   RF   R`   t   loadR   Rf   R   t   strRE   t   copyt   _get_all_optionsRG   R   RI   R   R‚   Rc   (   R   t   errRF   R   t   defaultR‰   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   get_default_values  s    	 c         C@  s-   |  j  t j ƒ |  j t d j | ƒ ƒ d  S(   Ns   {}
(   t   print_usageRe   t   stderrRf   R   R    (   R   R,   (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR     s    (	   R?   R@   RA   R   Ri   Rt   RE   R‘   R   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyR\      s   					=	(   RA   t
   __future__R    t   loggingR   Re   R)   t   distutils.utilR   t   pip._vendor.contextlib2R   t   pip._vendor.sixR   t   pip._internal.cli.status_codesR   t   pip._internal.configurationR   R   t   pip._internal.utils.compatR   t   pip._internal.utils.miscR   t	   getLoggerR?   Rn   R   R	   RB   Rb   RO   R\   (    (    (    sf   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/cli/parser.pyt   <module>   s"   P