????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/cli/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/cli/parser.pyc

�
}�\]c@@sdZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZmZddlmZeje�Zd	ejfd
��YZdefd��YZd
ejfd��YZdefd��YZd�ZdS(sBase option parser setupi(tabsolute_importN(t	strtobool(tstring_types(t
UNKNOWN_ERROR(t
ConfigurationtConfigurationError(tget_terminal_sizetPrettyHelpFormattercB@s\eZdZd�Zd�Zddd�Zd�Zd�Zd�Zd	�Z	d
�Z
RS(s4A prettier/less verbose help formatter for optparse.cO@sCd|d<d|d<t�dd|d<tjj|||�dS(Nitmax_help_positionitindent_incrementiitwidth(RtoptparsetIndentedHelpFormattert__init__(tselftargstkwargs((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyR
s

cC@s|j|dd�S(Ns <%s>s, (t_format_option_strings(Rtoption((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytformat_option_stringsss <%s>s, cC@s�g}|jr&|j|jd�n|jrF|j|jd�nt|�dkrk|jd|�n|j�r�|jp�|jj�}|j||j��ndj	|�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 - evaluated as mvarfmt % metavar
        :param optsep:  separator
        iit(
t_short_optstappendt
_long_optstlentinsertttakes_valuetmetavartdesttlowertjoin(RRtmvarfmttoptseptoptsR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyR s		cC@s|dkrdS|dS(NtOptionsRs:
((Rtheading((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytformat_heading7scC@s#d|jtj|�d�}|S(sz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        s
Usage: %s
s  (tindent_linesttextwraptdedent(Rtusagetmsg((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytformat_usage<scC@sy|rqt|jd�r!d}nd}|jd�}|j�}|jtj|�d�}d||f}|SdSdS(NtmaintCommandstDescriptions
s  s%s:
%s
R(thasattrtparsertlstriptrstripR%R&R'(Rtdescriptiontlabel((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytformat_descriptionDs	cC@s|r
|SdSdS(NR((Rtepilog((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyt
format_epilogVscC@s3g|jd�D]}||^q}dj|�S(Ns
(tsplitR(Rttexttindenttlinet	new_lines((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyR%]s&(t__name__t
__module__t__doc__R
RRR$R*R4R6R%(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRs						tUpdatingDefaultsHelpFormattercB@seZdZd�ZRS(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.
    cC@s;|jdk	r(|jj|jj�ntjj||�S(N(R/tNonet_update_defaultstdefaultsRRtexpand_default(RR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRCis(R<R=R>RC(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyR?bstCustomOptionParsercB@s eZd�Zed��ZRS(cO@s6|j||�}|jj�|jj||�|S(s*Insert an OptionGroup at a given position.(tadd_option_groupt
option_groupstpopR(RtidxRRtgroup((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytinsert_option_groupqs
cC@s2|j}x!|jD]}|j|j�qW|S(s<Get a list of all options, including those in option groups.(toption_listRFtextend(Rtresti((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytoption_list_allzs
(R<R=RJtpropertyRO(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRDos		tConfigOptionParsercB@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(ssCustom option parser which updates its defaults by checking the
    configuration files and environmental variablescO@s\|jd�|_|jdt�}t|�|_|jsBt�tjj|||�dS(Ntnametisolated(	RGRRtFalseRtconfigtAssertionErrorRtOptionParserR
(RRRRS((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyR
�s
cC@sGy|j||�SWn,tjk
rB}d|GHtjd�nXdS(Ns*An error occurred during configuration: %si(tcheck_valueRtOptionValueErrortsystexit(RRtkeytvaltexc((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyt
check_default�s
	cc@s�d|jdg}d�|D�}xw|jj�D]f\}}|sZtjd|�q2n|jdd�\}}||kr2||j||f�q2q2Wx4|D],}x#||D]\}}||fVq�Wq�WdS(Ntglobals:env:cS@si|]}g|�qS(((t.0RR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pys
<dictcomp>�s	s7Ignoring configuration key '%s' as it's value is empty.t.i(RRRUtitemstloggertdebugR7R(Rtoverride_ordert
section_itemstsection_keyR]tsectionR\((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyt _get_ordered_configuration_items�s
c
C@s�tj|j�|_t�}xy|j�D]k\}}|jd|�}|dkr\q+n|jdkr�yt	|�}Wq�t
k
r�t|j||�}|j|�q�Xn�|jdkr�|j
�}g|D]}|j|||�^q�}n�|jdkrt|j|j�|j�}|j||�}|jpCd	}	|jpRi}
|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_truetstore_falsetcountRtcallbackN(s
store_truesstore_falsescount((RtValuesRBtvaluestsetRjt
get_optionR@tactionRt
ValueErrortinvalid_config_error_messageterrorR7R_taddRtget_opt_stringt
convert_valuet
callback_argstcallback_kwargsRntgetattr(RRBt	late_evalR\R]Rt	error_msgtvtopt_strRR((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRA�s:	
+
	cC@s�|jstj|j�Sy|jj�Wn)tk
rU}|jtt	|��nX|j
|jj��}x]|j�D]O}|j
|j�}t|t�r{|j�}|j||�||j<q{q{Wtj|�S(s�Overriding to make updating the defaults after instantiation of
        the option parser possible, _update_defaults() does the dirty work.(tprocess_default_valuesRRoRBRUtloadRR[RtstrRAtcopyt_get_all_optionstgetRt
isinstanceRRxRX(RterrRBRtdefaultR�((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pytget_default_values�s	 cC@s(|jtj�|jtd|�dS(Ns%s
(tprint_usageRZtstderrR[R(RR)((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRv�s(	R<R=R>R
R_RjRAR�Rv(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRQ�s					1	cC@s,|dkrdj||�Sdj||�S(sQReturns a better error message when invalid configuration option
    is provided.RkRlso{0} is not a valid value for {1} option, please specify a boolean value like yes/no, true/false or 1/0 instead.s[{0} is not a valid value for {1} option, please specify a numerical value like 1/0 instead.(s
store_truesstore_false(tformat(RsR\R]((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyRu�s

(R>t
__future__RtloggingRRZR&tdistutils.utilRtpip._vendor.sixRtpip._internal.cli.status_codesRtpip._internal.configurationRRtpip._internal.utils.compatRt	getLoggerR<RdRRR?RWRDRQRu(((s7/tmp/pip-install-ewDPok/pip/pip/_internal/cli/parser.pyt<module>s O
w