Your IP : 216.73.216.137
�
��fxEc@sKdZddlZddlZddlZddlZddlTdZejde�Zejdeef�Z e
jdd�ZGd d
�d
�Z
dd�Zd
d�ejD�Zdd�Zdd�ZGdd�d�ZedkrGdZxKddddfD]7Zede�edjeee���e�q WndS(u6distutils.fancy_getopt
Wrapper around the standard getopt module that provides the following
additional features:
* short and long options are tied together
* options have help strings, so fancy_getopt could potentially
create a complete usage summary
* options set attributes of a passed-in object
iN(u*u[a-zA-Z](?:[a-zA-Z0-9-]*)u^%s$u^(%s)=!(%s)$u-u_cBs�|EeZdZdZddd�Zdd�Zdd�Zdddd �Zd
d�Z dd
�Z
dd�Zdd�Zdd�Z
dd�Zdddd�Zdd�Zddd�Zdddd�ZdS(uFancyGetoptu�Wrapper around the standard 'getopt()' module that provides some
handy extra functionality:
* short and long options are tied together
* options have help strings, and help text can be assembled
from them
* options set attributes of a passed-in object
* boolean options can have "negative aliases" -- eg. if
--quiet is the "negative alias" of --verbose, then "--quiet"
on the command line sets 'verbose' to false
cCst||_i|_|jr(|j�ni|_i|_g|_g|_i|_i|_i|_ g|_
dS(N(uoption_tableuoption_indexu_build_indexualiasunegative_aliasu
short_optsu long_optsu
short2longu attr_nameu takes_arguoption_order(uselfuoption_table((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu__init__)s
uFancyGetopt.__init__cCs6|jj�x"|jD]}||j|d<qWdS(Ni(uoption_indexuclearuoption_table(uselfuoption((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu_build_indexQs
uFancyGetopt._build_indexcCs||_|j�dS(N(uoption_tableu_build_index(uselfuoption_table((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuset_option_tableVs uFancyGetopt.set_option_tablecCsR||jkr"td|��n,|||f}|jj|�||j|<dS(Nu'option conflict: already an option '%s'(uoption_indexuDistutilsGetoptErroruoption_tableuappend(uselfulong_optionushort_optionuhelp_stringuoption((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
add_optionZsuFancyGetopt.add_optioncCs
||jkS(ucReturn true if the option table for this parser has an
option with long name 'long_option'.(uoption_index(uselfulong_option((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
has_optioncsuFancyGetopt.has_optioncCs
|jt�S(u�Translate long option name 'long_option' to the form it
has as an attribute of some object: ie., translate hyphens
to underscores.(u translateu
longopt_xlate(uselfulong_option((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
get_attr_namehsuFancyGetopt.get_attr_namecCs�t|t�st�xp|j�D]b\}}||jkrYtd|||f��n||jkr"td|||f��q"q"WdS(Nu(invalid %s '%s': option '%s' not definedu0invalid %s '%s': aliased option '%s' not defined(u
isinstanceudictuAssertionErroruitemsuoption_indexuDistutilsGetoptError(uselfualiasesuwhatualiasuopt((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu_check_alias_dictnsuFancyGetopt._check_alias_dictcCs|j|d�||_dS(u'Set the aliases for this option parser.ualiasN(u_check_alias_dictualias(uselfualias((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuset_aliasesxsuFancyGetopt.set_aliasescCs|j|d�||_dS(u�Set the negative aliases for this option parser.
'negative_alias' should be a dictionary mapping option names to
option names, both the key and value must already be defined
in the option table.unegative aliasN(u_check_alias_dictunegative_alias(uselfunegative_alias((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuset_negative_aliases}su FancyGetopt.set_negative_aliasescCs�g|_g|_|jj�i|_xa|jD]V}t|�dkrb|\}}}d}n:t|�dkr�|\}}}}ntd|f��t|t �s�t|�dkr�t
d|��n|dkp�t|t �o�t|�dkst
d|��n||j|<|jj|�|dd krq|rQ|d
}n|dd�}d|j
|<na|jj|�}|dk r�|j
|r�t
d||f��n||jd<nd|j
|<|jj|�}|dk r&|j
||j
|kr&t
d||f��q&ntj|�sHt
d
|��n|j|�|j|<|r2|jj|�||j|d<q2q2WdS(u�Populate the various data structures that keep tabs on the
option table. Called by 'getopt()' before it can do anything
worthwhile.
iiiuinvalid option tuple: %riu9invalid long option '%s': must be a string of length >= 2iu:invalid short option '%s': must a single character or Noneu=u:u>invalid negative alias '%s': aliased option '%s' takes a valueuginvalid alias '%s': inconsistent with aliased option '%s' (one of them takes a value, the other doesn'tuEinvalid long option name '%s' (must be letters, numbers, hyphens onlyNi����i����i����(u long_optsu
short_optsu
short2longuclearurepeatuoption_tableulenu
ValueErroru
isinstanceustruDistutilsGetoptErroruNoneuappendu takes_argunegative_aliasugetualiasu
longopt_reumatchu
get_attr_nameu attr_name(uselfuoptionulongushortuhelpurepeatualias_to((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu_grok_option_table�s^
"
!
uFancyGetopt._grok_option_tablecCs>|dkr"tjdd�}n|dkr@t�}d
}nd}|j�dj|j�}y"t j |||j
�\}}Wn4t jk
r�}zt|��WYdd}~XnXxh|D]`\}}t
|�dkr|ddkr|j|d}n>t
|�dkr,|dd�dks2t�|dd�}|jj|�} | rc| }n|j|s�|dks�td ��|jj|�} | r�| }d}q�d}n|j|}
|r�|jj|
�dk r�t||
d�d}nt||
|�|jj||f�q�W|r6||fS|SdS(uParse command-line options in args. Store as attributes on object.
If 'args' is None or not supplied, uses 'sys.argv[1:]'. If
'object' is None or not supplied, creates a new OptionDummy
object, stores option values there, and returns a tuple (args,
object). If 'object' is supplied, it is modified in place and
'getopt()' just returns 'args'; in both cases, the returned
'args' is a modified copy of the passed-in 'args' list, which
is left untouched.
iNu iiu-u--uuboolean option can't have valueTF(uNoneusysuargvuOptionDummyuTrueuFalseu_grok_option_tableujoinu
short_optsugetoptu long_optsuerroruDistutilsArgErrorulenu
short2longuAssertionErrorualiasugetu takes_argunegative_aliasu attr_nameurepeatugetattrusetattruoption_orderuappend(uselfuargsuobjectucreated_objectu
short_optsuoptsumsguoptuvalualiasuattr((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyugetopt�sF
"".
uFancyGetopt.getoptcCs)|jdkrtd��n|jSdS(u�Returns the list of (option, value) tuples processed by the
previous run of 'getopt()'. Raises RuntimeError if
'getopt()' hasn't been called yet.
u!'getopt()' hasn't been called yetN(uoption_orderuNoneuRuntimeError(uself((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuget_option_ordersuFancyGetopt.get_option_ordercCs�d}x||jD]q}|d}|d}t|�}|ddkrS|d}n|d k rl|d}n||kr|}qqW|ddd}d}||} d|}
|r�|g}n dg}x|jD]}|d d
�\}}}t|| �}
|ddkr'|dd�}n|d krt|
rZ|jd|||
df�q�|jd||f�nHd
||f}|
r�|jd|||
df�n|jd|�x)|
dd �D]}|j|
|�q�Wq�W|S(u�Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object.
iiu=iiiNu uOption summary:Niu --%-*s %su
--%-*s u%s (-%s)u --%-*si����i����i����(uoption_tableulenuNoneu wrap_textuappend(uselfuheaderumax_optuoptionulongushortulu opt_widthu
line_widthu
text_widthu
big_indentulinesuhelputextu opt_names((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
generate_helpsF
! uFancyGetopt.generate_helpcCsG|dkrtj}nx(|j|�D]}|j|d�q(WdS(Nu
(uNoneusysustdoutu
generate_helpuwrite(uselfuheaderufileuline((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
print_helphsuFancyGetopt.print_helpN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__u_build_indexuset_option_tableu
add_optionu
has_optionu
get_attr_nameu_check_alias_dictuset_aliasesuset_negative_aliasesu_grok_option_tableugetoptuget_option_orderu
generate_helpu
print_help(u
__locals__((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuFancyGetopts
(
M=
OuFancyGetoptcCs)t|�}|j|�|j||�S(N(uFancyGetoptuset_negative_aliasesugetopt(uoptionsunegative_optuobjectuargsuparser((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyufancy_getoptos
ufancy_getoptcCsi|]}dt|��qS(u (uord(u.0u_wschar((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
<dictcomp>us u
<dictcomp>cCs�|dkrgSt|�|kr)|gS|j�}|jt�}tjd|�}dd�|D�}g}x|r}g}d}xt|r�t|d�}|||kr�|j|d�|d=||}q�|r�|d ddkr�|d
=nPq�W|rd|dkrC|j|dd|��|d|d�|d<n|dddkrd|d=qdn|jdj|��qrW|S(u�wrap_text(text : string, width : int) -> [string]
Split 'text' into multiple lines of no more than 'width' characters
each, and return the list of strings that results.
u( +|-+)cSsg|]}|r|�qS(((u.0uch((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu
<listcomp>�s uwrap_text.<locals>.<listcomp>iiu Nui����i����( uNoneulenu
expandtabsu translateuWS_TRANSureusplituappendujoin(utextuwidthuchunksulinesucur_lineucur_lenul((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu wrap_textws:
u wrap_textcCs
|jt�S(uXConvert a long option name to a valid Python identifier by
changing "-" to "_".
(u translateu
longopt_xlate(uopt((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyutranslate_longopt�sutranslate_longoptcBs)|EeZdZdZgdd�ZdS(uOptionDummyu_Dummy class just used as a place to hold command-line option
values as instance attributes.cCs%x|D]}t||d�qWdS(ukCreate a new OptionDummy instance. The attributes listed in
'options' will be initialized to None.N(usetattruNone(uselfuoptionsuopt((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu__init__�s
uOptionDummy.__init__N(u__name__u
__module__u__qualname__u__doc__u__init__(u
__locals__((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyuOptionDummy�suOptionDummyu__main__u�Tra-la-la, supercalifragilisticexpialidocious.
How *do* you spell that odd word, anyways?
(Someone ask Mary -- she'll know [or she'll
say, "How should I know?"].)i
iii(u width: %du
(u__doc__usysustringureugetoptudistutils.errorsulongopt_patucompileu
longopt_reuneg_alias_reustru maketransu
longopt_xlateuFancyGetoptufancy_getoptu
whitespaceuWS_TRANSu wrap_textutranslate_longoptuOptionDummyu__name__utextuwuprintujoin(((u;/opt/alt/python33/lib64/python3.3/distutils/fancy_getopt.pyu<module> s($
�S6
?>