Tryag File Manager
Home
-
Turbo Force
Current Path :
/
proc
/
self
/
root
/
usr
/
lib
/
python2.4
/
distutils
/
Upload File :
New :
File
Dir
//proc/self/root/usr/lib/python2.4/distutils/fancy_getopt.pyc
mò ‚=5Dc�����������@���sA��d��Z��d�Z�d�k�Z�d�k�Z�d�k�Z�d�k�Td�k�Z�d�k�Td�Z�e�i �d�e�ƒ�Z �e�i �d�e�e�f�ƒ�Z�e�i�d�d�ƒ�Z �d �f��d �„��ƒ��YZ�d�„��Z�e�i�e�i�d�e�e�i�ƒ�ƒ�Z�d �„��Z�d�„��Z�d�f��d�„��ƒ��YZ�e�d�j�oK�d�Z�x>�d�d�d�d�f�D]*�Z�d�e�GHe�i�e�e�e�ƒ�d�ƒ�GHHqWn�d�S(���s6��distutils.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 s8���$Id: fancy_getopt.py 37828 2004-11-10 22:23:15Z loewis $N(���t���*s���[a-zA-Z](?:[a-zA-Z0-9-]*)s���^%s$s���^(%s)=!(%s)$t���-t���_t���FancyGetoptc�����������B���s¤���t��Z�d��Z�e�d�„�Z�d�„��Z�d�„��Z�e�e�d�„�Z�d�„��Z�d�„��Z �d�„��Z �d�„��Z�d �„��Z�d �„��Z �e�e�d�„�Z�d�„��Z�e�d �„�Z�e�e�d�„�Z�RS(���sÕ��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 c���������C���sv���|�|��_��h��|��_�|��i��o�|��i�ƒ��n�h��|��_�h��|��_�g��|��_�g��|��_�h��|��_�h��|��_ �h��|��_ �g��|��_�d��S(���N(���t���option_tablet���selft���option_indext���_build_indext���aliast���negative_aliast ���short_optst ���long_optst ���short2longt ���attr_namet ���takes_argt���option_order(���R���R���(����(����t,���/usr/lib/python2.4/distutils/fancy_getopt.pyt���__init__.���s���� c���������C���s6���|��i�i�ƒ��x"�|��i�D]�}�|�|��i�|�d�<q�Wd��S(���Ni����(���R���R���t���clearR���t���option(���R���R���(����(����R���R���Z���s���� �c���������C���s���|�|��_��|��i�ƒ��d��S(���N(���R���R���R���(���R���R���(����(����R���t���set_option_table_���s���� c���������C���sT���|��i�i�|�ƒ�o�t�d�|�‚�n-�|�|�|�f�}�|��i�i �|�ƒ�|�|��i�|�<d��S(���Ns'���option conflict: already an option '%s'( ���R���R���t���has_keyt���long_optiont���DistutilsGetoptErrort���short_optiont���help_stringR���R���t���append(���R���R���R���R���R���(����(����R���t ���add_optionc���s ����c���������C���s���|��i�i�|�ƒ�S(���sc���Return true if the option table for this parser has an option with long name 'long_option'.N(���R���R���R���R���(���R���R���(����(����R���t ���has_optionm���s�����c���������C���s���t��i�|�t�ƒ�S(���s’���Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.N(���t���stringt ���translateR���t ���longopt_xlate(���R���R���(����(����R���t ���get_attr_namer���s�����c���������C���s•���t��|�ƒ�t�j�p�t�‚�xt�|�i�ƒ��D]f�\�}�}�|��i�i �|�ƒ�p�t �d�|�|�|�f�‚�n�|��i�i �|�ƒ�p�t �d�|�|�|�f�‚�q'�q'�Wd��S(���Ns(���invalid %s '%s': option '%s' not defineds0���invalid %s '%s': aliased option '%s' not defined(���t���typet���aliasest���DictionaryTypet���AssertionErrort���itemsR���t���optR���R���R���R���t���what(���R���R"���R'���R&���R���(����(����R���t���_check_alias_dicty���s���� �c���������C���s���|��i�|�d�ƒ�|�|��_�d�S(���s'���Set the aliases for this option parser.R���N(���R���R(���R���(���R���R���(����(����R���t���set_aliases…���s�����c���������C���s���|��i�|�d�ƒ�|�|��_�d�S(���sÚ���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.s���negative aliasN(���R���R(���R ���(���R���R ���(����(����R���t���set_negative_aliasesŠ���s�����c���������C���s¬��g��|��_�g��|��_�|��i�i�ƒ��h��|��_�x}|��i�D]r}�t�|�ƒ�d�j�o�|�\�}�}�}�d�}�n:�t�|�ƒ�d�j�o�|�\�}�}�}�}�n�t�d�|�f�‚�t �|�ƒ�t�j �p�t�|�ƒ�d�j��o�t�d�|�‚�n�|�d�j�p#�t �|�ƒ�t�j�o�t�|�ƒ�d�j�p�t�d�|�‚�n�|�|��i�|�<|��i�i�|�ƒ�|�d �d �j�o3�|�o�|�d�}�n�|�d�d �!}�d�|��i�|�<np�|��i�i�|�ƒ�}�|�d�j �oC�|��i�|�o�t�d�|�|�f�‚�n�|�|��i�d �<d�|��i�|�<n�d�|��i�|�<|��i�i�|�ƒ�}�|�d�j �o6�|��i�|�|��i�|�j�o�t�d �|�|�f�‚�q=n�t�i�|�ƒ�p�t�d�d�|�‚�n�|��i�|�ƒ�|��i�|�<|�o%�|��i�i�|�ƒ�|�|��i�|�d�<q2�q2�Wd�S(���s���Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. i���i����i���s���invalid option tuple: %ri���s9���invalid long option '%s': must be a string of length >= 2i���s:���invalid short option '%s': must a single character or Noneiÿÿÿÿt���=t���:s>���invalid negative alias '%s': aliased option '%s' takes a valuesg���invalid alias '%s': inconsistent with aliased option '%s' (one of them takes a value, the other doesn'ts���invalid long option name '%s' s'���(must be letters, numbers, hyphens onlyN(���R���R���R ���R���R���t���repeatR���R���t���lent���longt���shortt���helpt ���ValueErrorR!���t ���StringTypeR���t���NoneR���R���R ���t���gett���alias_toR���t ���longopt_ret���matchR ���R ���(���R���R0���R1���R/���R6���R-���R���(����(����R���t���_grok_option_table“���sR����� � &3 � c���������C���s0��|�d�j�o�t�i�d�}�n�|�d�j�o�t�ƒ��}�d�}�n�d�}�|��i�ƒ��t �i �|��i�ƒ�}�y"�t�i�|�|�|��i �ƒ�\�} �}�Wn!�t�i�j �o�}�t�|�‚�n�Xxj| �D]b\�}�}�t�|�ƒ�d�j�o&�|�d�d�j�o�|��i�|�d�}�n6�t�|�ƒ�d�j�o�|�d� d�j�p�t�‚�|�d�}�|��i�i�|�ƒ�}�|�o �|�}�n�|��i�|�pJ�|�d�j�p �t�d�‚�|��i�i�|�ƒ�}�|�o�|�}�d�}�q¢d�}�n�|��i�|�} �|�o3�|��i�i�| �ƒ�d�j �o�t�|�| �d�ƒ�d�}�n�t�|�| �|�ƒ�|��i �i!�|�|�f�ƒ�q�W|�o�|�|�f�Sn�|�Sd�S( ���s��Parse 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. i���i����i���R���s���--t����s���boolean option can't have valueN("���t���argsR4���t���syst���argvt���objectt���OptionDummyt���created_objectR���R9���R���t���joinR ���t���getoptR���t���optst���errort���msgt���DistutilsArgErrorR&���t���valR.���R���R$���R���R5���R���R ���R ���t���attrR-���t���getattrt���setattrR���R���(���R���R;���R>���R&���R���RE���RG���R@���R ���RC���RH���(����(����R���RB���ë���sJ���� � "�$+ c���������C���s(���|��i�d�j�o �t�d�‚�n�|��i�Sd�S(���s«���Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet. s!���'getopt()' hasn't been called yetN(���R���R���R4���t���RuntimeError(���R���(����(����R���t���get_option_order+��s����� c���������C���sñ��d�}�x‚�|��i�D]w�}�|�d�} �|�d�}�t�| �ƒ�} �| �d�d�j�o�| �d�} �n�|�d�j �o�| �d�} �n�| �|�j�o �| �}�q�q�W|�d�d�d�}�d�}�|�|�} �d�|�}�|�o �|�g�}�n �d �g�}�x|��i�D]}�|�d � \�} �}�}�t�|�| �ƒ�}�| �d�d�j�o�| �d�d�!} �n�|�d�j�oD�|�o"�|�i�d�|�| �|�d�f�ƒ�qÃ|�i�d�|�| �f�ƒ�nK�d �| �|�f�}�|�o"�|�i�d�|�|�|�d�f�ƒ�n�|�i�d�|�ƒ�x#�|�d�D]�} �|�i�|�| �ƒ�qÎWqÞ�W|�S(���sŒ���Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object. i����i���iÿÿÿÿR+���i���i���iN���t��� s���Option summary:i���s��� --%-*s %ss ��� --%-*s s���%s (-%s)s��� --%-*sN(���t���max_optR���R���R���R/���R0���R.���t���lR4���t ���opt_widtht ���line_widtht ���text_widtht ���big_indentt���headert���linesR1���t ���wrap_textt���textR���t ���opt_names(���R���RT���RQ���R0���R���RX���RS���RW���RU���RO���R/���RN���RP���RR���R1���(����(����R���t ���generate_help6��sL����� � � ""�c���������C���sI���|�d��j�o �t�i�}�n�x(�|��i�|�ƒ�D]�}�|�i�|�d�ƒ�q*�Wd��S(���Ns��� ( ���t���fileR4���R<���t���stdoutR���RY���RT���t���linet���write(���R���RT���RZ���R\���(����(����R���t ���print_helpŠ��s ���� �(���t���__name__t ���__module__t���__doc__R4���R���R���R���R���R���R ���R(���R)���R*���R9���RB���RL���RY���R^���(����(����(����R���R���"���s��� �, X@ Tc���������C���s)���t��|��ƒ�}�|�i�|�ƒ�|�i�|�|�ƒ�S(���N(���R���t���optionst���parserR*���t���negative_optRB���R;���R>���(���Rb���Rd���R>���R;���Rc���(����(����R���t���fancy_getopt“��s���� RM���c���������C���s—��|��d�j�o�g��Sn�t�|��ƒ�|�j�o�|��g�Sn�t�i�|��ƒ�}��t�i�|��t�ƒ�}��t�i �d�|��ƒ�}�t�d�|�ƒ�}�g��}�x|�o g��}�d�}�x{�|�os�t�|�d�ƒ�}�|�|�|�j�o&�|�i�|�d�ƒ�|�d�=|�|�}�q”�|�o �|�d�d�d�j�o�|�d�=n�Pq”�W|�o_�|�d�j�o.�|�i�|�d�d�|�!ƒ�|�d�|�|�d�<n�|�d�d�d�j�o�|�d�=qun�|�i�t�i�|�d�ƒ�ƒ�q~�W|�S(���s¶���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. s���( +|-+)i����iÿÿÿÿRM���R:���N(���RW���R4���R.���t���widthR���t ���expandtabsR���t���WS_TRANSt���ret���splitt���chunkst���filterRU���t���cur_linet���cur_lenRO���R���RA���(���RW���Rf���RU���RO���Rm���Rk���Rn���(����(����R���RV���›��s@����� �� c���������C���s���t��i�|��t�ƒ�S(���sX���Convert a long option name to a valid Python identifier by changing "-" to "_". N(���R���R���R&���R���(���R&���(����(����R���t���translate_longoptØ��s�����R?���c�����������B���s���t��Z�d��Z�g��d�„�Z�RS(���s_���Dummy class just used as a place to hold command-line option values as instance attributes.c���������C���s%���x�|�D]�}�t�|��|�d�ƒ�q�Wd�S(���sk���Create a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.N(���Rb���R&���RJ���R���R4���(���R���Rb���R&���(����(����R���R���ã��s������(���R_���R`���Ra���R���(����(����(����R���R?���ß��s����t���__main__s¢���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 ���i���i���i(���s ���width: %ds��� (���Ra���t���__revision__R<���R���Ri���t���typesRB���t���distutils.errorst���longopt_patt���compileR7���t���neg_alias_ret ���maketransR���R���Re���t ���whitespaceR.���Rh���RV���Ro���R?���R_���RW���t���wRA���(���Rh���Rq���R���R?���R7���RW���Ro���R<���Ri���R���Rt���Rv���Ry���R���RB���RV���Re���(����(����R���t���? ���s.��� ÿ�r " = �