Files
PowerToys/PythonHome/Lib/site-packages/pip/baseparser.pyc

50 lines
10 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<00>Sc@s<>dZddlZddlZddlZddlZddlmZddlmZm Z ddl
m Z ddl m Z mZddlmZdejfd <00><00>YZd
efd <00><00>YZd ejfd <00><00>YZdefd<00><00>YZdS(sBase option parser setupi<70><69><EFBFBD><EFBFBD>N(t strtobool(t ConfigParsert string_types(tdefault_config_file(tget_terminal_sizetget_prog(t pkg_resourcestPrettyHelpFormattercBs\eZdZd<00>Zd<00>Zddd<00>Zd<00>Zd<00>Zd<00>Zd <00>Z d
<00>Z
RS( s4A prettier/less verbose help formatter for optparse.cOsCd|d<d|d<t<00>dd|d<tjj|||<00>dS(Nitmax_help_positionitindent_incrementiitwidth(RtoptparsetIndentedHelpFormattert__init__(tselftargstkwargs((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyR s

cCs|j|dd<00>S(Ns <%s>s, (t_format_option_strings(Rtoption((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytformat_option_stringsss <%s>s, cCs<>g}|jr&|j|jd<19>n|jrF|j|jd<19>nt|<00>dkrk|jd|<00>n|j<00>r<>|jp<>|jj<00>}|j||j<00><16>ndj |<00>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_optstlentinsertt takes_valuetmetavartdesttlowertjoin(RRtmvarfmttoptseptoptsR((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRs   cCs|dkrdS|dS(NtOptionsRs:
((Rtheading((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytformat_heading3s cCs#d|jtj|<00>d<00>}|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((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyt format_usage8scCsy|rqt|jd<00>r!d}nd}|jd<00>}|j<00>}|jtj|<00>d<00>}d||f}|SdSdS(NtmaintCommandst Descriptions
s s%s:
%s
R(thasattrtparsertlstriptrstripR%R&R'(Rt descriptiontlabel((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytformat_description@s  cCs|r
|SdSdS(NR((Rtepilog((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyt format_epilogRscCs3g|jd<00>D]}||^q}dj|<00>S(Ns
(tsplitR(Rttexttindenttlinet new_lines((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyR%Ys&( t__name__t
__module__t__doc__R RRR$R*R4R6R%(((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRs      tUpdatingDefaultsHelpFormattercBseZdZd<00>ZRS(s<>Custom 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|jj<00>ntjj||<00>S(N(R/tNonetupdate_defaultstdefaultsR R texpand_default(RR((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRCcs(R<R=R>RC(((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyR?^stCustomOptionParsercBs eZd<00>Zed<00><00>ZRS(cOs6|j||<00>}|jj<00>|jj||<00>|S(s*Insert an OptionGroup at a given position.(tadd_option_groupt option_groupstpopR(RtidxRRtgroup((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytinsert_option_groupjs cCs2|j}x!|jD]}|j|j<00>qW|S(s<Get a list of all options, including those in option groups.(t option_listRFtextend(Rtresti((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytoption_list_allss
(R<R=RJtpropertyRO(((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRDis tConfigOptionParsercBsbeZdZd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zdd<00>Z d <00>Z
d
<00>Z RS( ssCustom option parser which updates its defaults by checking the
configuration files and environmental variablescOsxtj<00>|_|jd<00>|_|j<00>|_|jrO|jj|j<00>n|js^t<00>t j
j |||<00>dS(Ntname( RtRawConfigParsertconfigRGRRtget_config_filestfilestreadtAssertionErrorR t OptionParserR (RRR((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyR <00>s cCsNtjjdt<00>}|tjkr(gS|rGtjj|<00>rG|gStgS(NtPIP_CONFIG_FILE(tostenvirontgettFalsetdevnulltpathtexistsR(Rt config_file((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRU<00>s cCsUy|j||<00>SWn:tjk
rPtj<00>d}d|GHtjd<00>nXdS(Nis*An error occurred during configuration: %si(t check_valueR tOptionValueErrortsystexc_infotexit(RRtkeytvalte((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyt check_default<6C>s  cCs,i}x6d|jfD]%}|j|j|j|<00><00><00>qW|j|j|j<00><00><00>x<>|j<00>D]<5D>\}}|j|<00>}|dk rh|s<>qhn|jdkr<>t |<00>}n|jdkr<>|j
<00>}g|D]}|j |||<00>^q<>}n|j |||<00>}|||j <qhqhW|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).tglobalt
store_truet store_falsetcountRN(s
store_trues store_falsescount( RRtupdatetnormalize_keystget_config_sectiontget_environ_varstitemst
get_optionR@tactionRR7RkR(RRBRTtsectionRhRiRtv((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRA<00>s"#  +cCsYi}xL|D]D\}}|jdd<00>}|jd<00>sGd|}n|||<q W|S(s<>Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
filest_t-s--s--%s(treplacet
startswith(RRtt
normalizedRhRi((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRq<00>s cCs&|jj|<00>r"|jj|<00>SgS(s Get a section of a configuration(RTt has_sectionRt(RRR((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRr<00>stPIP_ccsSxLtjj<00>D];\}}|j|<00>r|j|d<00>j<00>|fVqqWdS(s@Returns a generator with all environmental vars with prefix PIP_RN(R[R\RtR|R{R(RtprefixRhRi((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRs<00>scCs<>|jstj|j<00>S|j|jj<00><00>}x]|j<00>D]O}|j|j<00>}t |t
<00>r>|j <00>}|j ||<00>||j<q>q>Wtj|<00>S(s<>Overridding to make updating the defaults after instantiation of
the option parser possible, update_defaults() does the dirty work.( tprocess_default_valuesR tValuesRBRAtcopyt_get_all_optionsR]Rt
isinstanceRtget_opt_stringRc(RRBRtdefaulttopt_str((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pytget_default_values<65>s   cCs(|jtj<00>|jdd|<16>dS(Nis%s
(t print_usageRetstderrRg(RR)((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyterror<6F>s( R<R=R>R RURkRARqRrRsR<>R<>(((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyRQ}s      (R>ReR R[R&tdistutils.utilRtpip.backwardcompatRRt pip.locationsRtpip.utilRRt pip._vendorRR RR?RYRDRQ(((sEc:\Users\lifqian\Desktop\Python27\lib\site-packages\pip\baseparser.pyt<module>s    O