Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyc

ó
“tÆ_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((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyR
s

cC@s
|j|ƒS(N(t_format_option_strings(Rtoption((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytformat_option_strings!ss <{}>s, cC@s»g}|jr&|j|jdƒn|jrF|j|jdƒnt|ƒdkrk|jd|ƒn|jƒr®|jpŒ|jjƒ}|j|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
        :param optsep:  separator
        iit(t_short_optstappendt
_long_optstlentinsertttakes_valuetmetavartdesttlowertformattjoin(RRtmvarfmttoptseptoptsR((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyR$s		cC@s|dkrdS|dS(NtOptionsRs:
((Rtheading((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytformat_heading;scC@s(dj|jtj|ƒdƒƒ}|S(sz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        s
Usage: {}
s  (Rtindent_linesttextwraptdedent(Rtusagetmsg((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytformat_usage@scC@s{|rst|jdƒr!d}nd}|jdƒ}|jƒ}|jtj|ƒdƒ}dj||ƒ}|SdSdS(NtmaintCommandstDescriptions
s  s{}:
{}
R(thasattrtparsertlstriptrstripR&R'R(R(Rtdescriptiontlabel((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytformat_descriptionIs	cC@s|r
|SdSdS(NR((Rtepilog((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyt
format_epilog[scC@s3g|jdƒD]}||^q}dj|ƒS(Ns
(tsplitR(Rttexttindenttlinet	new_lines((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyR&bs&(t__name__t
__module__t__doc__R
RRR%R+R5R7R&(((sI/opt/alt/python35/lib/python3.5/site-packages/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(R0tNonet_update_defaultstdefaultsRRtexpand_default(RR((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyRDns(R=R>R?RD(((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyR@gstCustomOptionParsercB@s eZd„Zed„ƒZRS(cO@s6|j||Ž}|jjƒ|jj||ƒ|S(s*Insert an OptionGroup at a given position.(tadd_option_groupt
option_groupstpopR(RtidxRRtgroup((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytinsert_option_groupvs
cC@s2|j}x!|jD]}|j|jƒqW|S(s<Get a list of all options, including those in option groups.(toption_listRGtextend(Rtresti((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytoption_list_alls
(R=R>RKtpropertyRP(((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyREts		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(	RHRStFalseRtconfigtAssertionErrorRtOptionParserR
(RRRRT((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyR
s
cC@sLy|j||ƒSWn1tjk
rG}dj|ƒGHtjdƒnXdS(Ns*An error occurred during configuration: {}i(tcheck_valueRtOptionValueErrorRtsystexit(RRtkeytvaltexc((sI/opt/alt/python35/lib/python3.5/site-packages/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.0RS((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pys
<dictcomp>¢s	s7Ignoring configuration key '%s' as it's value is empty.t.i(RSRVtitemstloggertdebugR8R(Rtoverride_ordert
section_itemstsection_keyR^tsectionR]((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyt _get_ordered_configuration_itemss
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(RlRmscount((RtValuesRCtvaluestsetRkt
get_optionRAtactionRt
ValueErrortinvalid_config_error_messageterrorR8R`taddRtget_opt_stringt
convert_valuet
callback_argstcallback_kwargsRotgetattr(RRCt	late_evalR]R^Rt	error_msgtvtopt_strRR((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyRBµ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_valuesRRpRCRVtloadRR\RtstrRBtcopyt_get_all_optionstgetRt
isinstanceRRyRY(RterrRCRtdefaultR((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pytget_default_valuesæs	 cC@s-|jtjƒ|jtdj|ƒƒdS(Ns{}
(tprint_usageR[tstderrR\RR(RR*((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyRwûs(	R=R>R?R
R`RkRBR‹Rw(((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyRR‰s					1	cC@s,|dkrdj||ƒSdj||ƒS(sQReturns a better error message when invalid configuration option
    is provided.RlRmso{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(R(RtR]R^((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyRvs

(R?t
__future__RtloggingRR[R'tdistutils.utilRtpip._vendor.sixRtpip._internal.cli.status_codesRtpip._internal.configurationRRtpip._internal.utils.compatRt	getLoggerR=ReRRR@RXRERRRv(((sI/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/parser.pyt<module>s P
w
Back to Directory File Manager