Your IP : 3.145.70.108


Current Path : /opt/alt/python33/lib/python3.3/site-packages/pip/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/__pycache__/baseparser.cpython-33.pyc

�
7�Re�c@s�dZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
mZddlmZGdd	�d	ej�ZGd
d�de�ZGdd
�d
ej�ZGdd�de�ZdS(uBase option parser setupiN(u	strtobool(uConfigParserustring_types(udefault_config_file(uget_terminal_sizeuget_prog(u
pkg_resourcescBs�|EeZdZdZdd�Zdd�Zdddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS(uPrettyHelpFormatteru4A prettier/less verbose help formatter for optparse.cOsCd|d<d|d<t�dd|d<tjj|||�dS(Niumax_help_positioniuindent_incrementiiuwidth(uget_terminal_sizeuoptparseuIndentedHelpFormatteru__init__(uselfuargsukwargs((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu__init__s

uPrettyHelpFormatter.__init__cCs|j|dd�S(Nu <%s>u, (u_format_option_strings(uselfuoption((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuformat_option_stringssu)PrettyHelpFormatter.format_option_stringsu <%s>u, cCs�g}|jr&|j|jd�n|jrF|j|jd�nt|�dkrk|jd|�n|j�r�|jp�|jj�}|j||j��ndj	|�S(u
        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
        iiu(
u_short_optsuappendu
_long_optsulenuinsertutakes_valueumetavarudestulowerujoin(uselfuoptionumvarfmtuoptsepuoptsumetavar((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu_format_option_stringss		u*PrettyHelpFormatter._format_option_stringscCs|dkrdS|dS(NuOptionsuu:
((uselfuheading((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuformat_heading3su"PrettyHelpFormatter.format_headingcCs#d|jtj|�d�}|S(uz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        u
Usage: %s
u  (uindent_linesutextwrapudedent(uselfuusageumsg((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuformat_usage8su PrettyHelpFormatter.format_usagecCsy|rqt|jd�r!d}nd}|jd�}|j�}|jtj|�d�}d||f}|SdSdS(NumainuCommandsuDescriptionu
u  u%s:
%s
u(uhasattruparserulstripurstripuindent_linesutextwrapudedent(uselfudescriptionulabel((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuformat_description@s	u&PrettyHelpFormatter.format_descriptioncCs|r
|SdSdS(Nu((uselfuepilog((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu
format_epilogRsu!PrettyHelpFormatter.format_epilogcs/�fdd�|jd�D�}dj|�S(Ncsg|]}�|�qS(((u.0uline(uindent(u'/tmp/pip-zej_zi-build/pip/baseparser.pyu
<listcomp>Zs	u4PrettyHelpFormatter.indent_lines.<locals>.<listcomp>u
(usplitujoin(uselfutextuindentu	new_lines((uindentu'/tmp/pip-zej_zi-build/pip/baseparser.pyuindent_linesYs"u PrettyHelpFormatter.indent_linesN(u__name__u
__module__u__qualname__u__doc__u__init__uformat_option_stringsu_format_option_stringsuformat_headinguformat_usageuformat_descriptionu
format_epiloguindent_lines(u
__locals__((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuPrettyHelpFormattersuPrettyHelpFormattercBs&|EeZdZdZdd�ZdS(uUpdatingDefaultsHelpFormatteru�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�ntjj||�S(N(uparseruNoneuupdate_defaultsudefaultsuoptparseuIndentedHelpFormatteruexpand_default(uselfuoption((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuexpand_defaultcsu,UpdatingDefaultsHelpFormatter.expand_defaultN(u__name__u
__module__u__qualname__u__doc__uexpand_default(u
__locals__((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuUpdatingDefaultsHelpFormatter^suUpdatingDefaultsHelpFormattercBs2|EeZdZdd�Zedd��ZdS(uCustomOptionParsercOs6|j||�}|jj�|jj||�|S(u*Insert an OptionGroup at a given position.(uadd_option_groupu
option_groupsupopuinsert(uselfuidxuargsukwargsugroup((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuinsert_option_groupjs
u&CustomOptionParser.insert_option_groupcCs;|jdd�}x!|jD]}|j|j�qW|S(u<Get a list of all options, including those in option groups.N(uoption_listu
option_groupsuextend(uselfuresui((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuoption_list_allssu"CustomOptionParser.option_list_allN(u__name__u
__module__u__qualname__uinsert_option_groupupropertyuoption_list_all(u
__locals__((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuCustomOptionParseris	uCustomOptionParsercBs�|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
dd�Zdd�ZdS(uConfigOptionParserusCustom option parser which updates its defaults by checking the
    configuration files and environmental variablescOsxtj�|_|jd�|_|j�|_|jrO|jj|j�n|js^t�t	j
j|||�dS(Nuname(uConfigParseruRawConfigParseruconfigupopunameuget_config_filesufilesureaduAssertionErroruoptparseuOptionParseru__init__(uselfuargsukwargs((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu__init__�s	uConfigOptionParser.__init__cCsNtjjdd�}|tjkr(gS|rGtjj|�rG|gStgS(NuPIP_CONFIG_FILEF(uosuenvironugetuFalseudevnullupathuexistsudefault_config_file(uselfuconfig_file((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuget_config_files�su#ConfigOptionParser.get_config_filescCs[y|j||�SWn@tjk
rVtj�d}td|�tjd�YnXdS(Niu*An error occurred during configuration: %si(ucheck_valueuoptparseuOptionValueErrorusysuexc_infouprintuexit(uselfuoptionukeyuvalue((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu
check_default�su ConfigOptionParser.check_defaultcs#i}x6d�jfD]%}|j�j�j|���qW|j�j�j���x�|j�D]�\�}�j����dk	rh|s�qhn�jd	kr�t	|�}n�jdkr�|j
�}���fdd�|D�}n�j��|�}||�j<qhqhW|S(
u�Updates the given defaults with values from the config files and
        the environ. Does a little special handling for certain types of
        options (lists).uglobalu
store_trueustore_falseucountuappendcs%g|]}�j��|��qS((u
check_default(u.0uv(ukeyuoptionuself(u'/tmp/pip-zej_zi-build/pip/baseparser.pyu
<listcomp>�s	u6ConfigOptionParser.update_defaults.<locals>.<listcomp>N(u
store_trueustore_falseucount(
unameuupdateunormalize_keysuget_config_sectionuget_environ_varsuitemsu
get_optionuNoneuactionu	strtoboolusplitu
check_defaultudest(uselfudefaultsuconfigusectionuval((ukeyuoptionuselfu'/tmp/pip-zej_zi-build/pip/baseparser.pyuupdate_defaults�s"#"u"ConfigOptionParser.update_defaultscCsYi}xL|D]D\}}|jdd�}|jd�sGd|}n|||<q
W|S(u�Return a config dictionary with normalized keys regardless of
        whether the keys were specified in environment variables or in config
        filesu_u-u--u--%s(ureplaceu
startswith(uselfuitemsu
normalizedukeyuval((u'/tmp/pip-zej_zi-build/pip/baseparser.pyunormalize_keys�s
u!ConfigOptionParser.normalize_keyscCs&|jj|�r"|jj|�SgS(u Get a section of a configuration(uconfiguhas_sectionuitems(uselfuname((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuget_config_section�su%ConfigOptionParser.get_config_sectionuPIP_ccsSxLtjj�D];\}}|j|�r|j|d�j�|fVqqWdS(u@Returns a generator with all environmental vars with prefix PIP_uN(uosuenvironuitemsu
startswithureplaceulower(uselfuprefixukeyuval((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuget_environ_vars�su#ConfigOptionParser.get_environ_varscCs�|jstj|j�S|j|jj��}x]|j�D]O}|j|j�}t	|t
�r>|j�}|j||�||j<q>q>Wtj|�S(u�Overridding to make updating the defaults after instantiation of
        the option parser possible, update_defaults() does the dirty work.(
uprocess_default_valuesuoptparseuValuesudefaultsuupdate_defaultsucopyu_get_all_optionsugetudestu
isinstanceustring_typesuget_opt_stringucheck_value(uselfudefaultsuoptionudefaultuopt_str((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuget_default_values�s	 u%ConfigOptionParser.get_default_valuescCs(|jtj�|jdd|�dS(Niu%s
(uprint_usageusysustderruexit(uselfumsg((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuerror�suConfigOptionParser.errorN(
u__name__u
__module__u__qualname__u__doc__u__init__uget_config_filesu
check_defaultuupdate_defaultsunormalize_keysuget_config_sectionuget_environ_varsuget_default_valuesuerror(u
__locals__((u'/tmp/pip-zej_zi-build/pip/baseparser.pyuConfigOptionParser}s	uConfigOptionParser(u__doc__usysuoptparseuosutextwrapudistutils.utilu	strtoboolupip.backwardcompatuConfigParserustring_typesu
pip.locationsudefault_config_fileupip.utiluget_terminal_sizeuget_progupip._vendoru
pkg_resourcesuIndentedHelpFormatteruPrettyHelpFormatteruUpdatingDefaultsHelpFormatteruOptionParseruCustomOptionParseruConfigOptionParser(((u'/tmp/pip-zej_zi-build/pip/baseparser.pyu<module>sO

?>