File "baseparser.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/baseparser.cpython-34.pyc
File size: 8.93 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


Re@sdZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
mZddlmZGdd	d	ejZGd
ddeZGdd
d
ejZGdddeZdS)zBase option parser setupN)	strtobool)ConfigParserstring_types)default_config_file)get_terminal_sizeget_prog)
pkg_resourcesc@s|eZdZdZddZddZdddd	Zd
dZdd
ZddZ	ddZ
ddZdS)PrettyHelpFormatterz4A prettier/less verbose help formatter for optparse.cOsCd|d<d|d<tdd|d<tjj|||dS)Nmax_help_positionindent_incrementrwidth)roptparseIndentedHelpFormatter__init__)selfargskwargsr)/tmp/pip-ztkk0jow-build/pip/baseparser.pyrs

zPrettyHelpFormatter.__init__cCs|j|ddS)Nz <%s>z, )_format_option_strings)roptionrrrformat_option_stringssz)PrettyHelpFormatter.format_option_stringsz <%s>z, cCsg}|jr&|j|jdn|jrF|j|jdnt|dkrk|jd|n|jr|jp|jj}|j||jndj	|S)a
        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
        rr)
_short_optsappend
_long_optsleninserttakes_valuemetavardestlowerjoin)rrmvarfmtoptsepoptsr"rrrrs		z*PrettyHelpFormatter._format_option_stringscCs|dkrdS|dS)NOptionsrz:
r)rheadingrrrformat_heading3sz"PrettyHelpFormatter.format_headingcCs#d|jtj|d}|S)zz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        z
Usage: %s
z  )indent_linestextwrapdedent)rusagemsgrrrformat_usage8sz PrettyHelpFormatter.format_usagecCsy|rqt|jdr!d}nd}|jd}|j}|jtj|d}d||f}|SdSdS)NmainCommandsDescription
z  z%s:
%s
r)hasattrparserlstriprstripr,r-r.)rdescriptionlabelrrrformat_description@s	z&PrettyHelpFormatter.format_descriptioncCs|r
|SdSdS)Nrr)repilogrrr
format_epilogRsz!PrettyHelpFormatter.format_epilogcs/fdd|jdD}dj|S)Ncsg|]}|qSrr).0line)indentrr
<listcomp>Zs	z4PrettyHelpFormatter.indent_lines.<locals>.<listcomp>r5)splitr%)rtextrA	new_linesr)rArr,Ys"z PrettyHelpFormatter.indent_linesN)__name__
__module____qualname____doc__rrrr+r1r<r>r,rrrrr	sr	c@s"eZdZdZddZdS)UpdatingDefaultsHelpFormatterzCustom help formatter for use in ConfigOptionParser that updates
    the defaults before expanding them, allowing them to show up correctly
    in the help listingcCs;|jdk	r(|jj|jjntjj||S)N)r7update_defaultsdefaultsrrexpand_default)rrrrrrMcsz,UpdatingDefaultsHelpFormatter.expand_defaultN)rFrGrHrIrMrrrrrJ^srJc@s.eZdZddZeddZdS)CustomOptionParsercOs6|j||}|jj|jj|||S)z*Insert an OptionGroup at a given position.)add_option_group
option_groupspopr )ridxrrgrouprrrinsert_option_groupjs
z&CustomOptionParser.insert_option_groupcCs;|jdd}x!|jD]}|j|jqW|S)z<Get a list of all options, including those in option groups.N)option_listrPextend)rresirrroption_list_allssz"CustomOptionParser.option_list_allN)rFrGrHrTpropertyrYrrrrrNis	rNc@seZdZdZddZddZddZdd	Zd
dZdd
Z	dddZ
ddZddZdS)ConfigOptionParserzsCustom option parser which updates its defaults by checking the
    configuration files and environmental variablescOsxtj|_|jd|_|j|_|jrO|jj|jn|js^tt	j
j|||dS)Nname)rRawConfigParserconfigrQr\get_config_filesfilesreadAssertionErrorrOptionParserr)rrrrrrrs	zConfigOptionParser.__init__cCsNtjjdd}|tjkr(gS|rGtjj|rG|gStgS)NPIP_CONFIG_FILEF)osenvirongetdevnullpathexistsr)rconfig_filerrrr_sz#ConfigOptionParser.get_config_filescCs[y|j||SWn@tjk
rVtjd}td|tjdYnXdS)Nrz*An error occurred during configuration: %s)check_valuerOptionValueErrorsysexc_infoprintexit)rrkeyvalerrr
check_defaultsz ConfigOptionParser.check_defaultcs#i}x6djfD]%}|jjj|qW|jjjx|jD]\}jdk	rh|sqhnjd	krt|}njdkr|j	}fdd|D}nj
|}||j<qhqhW|S)
zUpdates the given defaults with values from the config files and
        the environ. Does a little special handling for certain types of
        options (lists).globalN
store_truestore_falsecountrcs%g|]}j|qSr)rv)r?v)rsrrrrrBs	z6ConfigOptionParser.update_defaults.<locals>.<listcomp>)z
store_truezstore_falsezcount)r\updatenormalize_keysget_config_sectionget_environ_varsitems
get_optionactionrrCrvr#)rrLr^sectionrtr)rsrrrrKs"#"z"ConfigOptionParser.update_defaultscCsYi}xL|D]D\}}|jdd}|jdsGd|}n|||<q
W|S)zReturn a config dictionary with normalized keys regardless of
        whether the keys were specified in environment variables or in config
        files_-z--z--%s)replace
startswith)rr
normalizedrsrtrrrr}s
z!ConfigOptionParser.normalize_keyscCs&|jj|r"|jj|SgS)z Get a section of a configuration)r^has_sectionr)rr\rrrr~sz%ConfigOptionParser.get_config_sectionPIP_ccsSxLtjjD];\}}|j|r|j|dj|fVqqWdS)z@Returns a generator with all environmental vars with prefix PIP_rN)rerfrrrr$)rprefixrsrtrrrrsz#ConfigOptionParser.get_environ_varscCs|jstj|jS|j|jj}x]|jD]O}|j|j}t	|t
r>|j}|j||||j<q>q>Wtj|S)zOverridding to make updating the defaults after instantiation of
        the option parser possible, update_defaults() does the dirty work.)
process_default_valuesrValuesrLrKcopy_get_all_optionsrgr#
isinstancerget_opt_stringrm)rrLrdefaultopt_strrrrget_default_valuess	 z%ConfigOptionParser.get_default_valuescCs(|jtj|jdd|dS)Nrz%s
)print_usagerostderrrr)rr0rrrerrorszConfigOptionParser.errorN)
rFrGrHrIrr_rvrKr}r~rrrrrrrr[}s	r[)rIrorrer-distutils.utilrZpip.backwardcompatrr
pip.locationsrpip.utilrrpip._vendorrrr	rJrcrNr[rrrr<module>sO