관리-도구
편집 파일: fancy_getopt.cpython-311.opt-1.pyc
� ����V�%;�������������� ������������d�Z�ddlZddlZddlZddlZddlT�dZ�ej��������dez��������������Z�ej��������de�de�d�������������Z e ���������������������d d ������������Z�G�d��d������������Z d ��Zd��ej��������D���������������Zd��Zd��Z�G�d��d������������Zedk����rGdZdD�]DZ�edez����������������ed����������������������eee��������������������������������������e����������������CdS�dS�)a6��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 �����N)�*z[a-zA-Z](?:[a-zA-Z0-9-]*)z^%s$z^(z)=!(z)$�-�_c��������������������p�����e�Zd�ZdZdd�Zd��Zd��Zdd�Zd��Zd��Z d ��Z d ��Zd��Zd��Z dd �Zd��Zdd�Zdd�ZdS�)�FancyGetopta���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 Nc������������������������||�_���������i�|�_��������|�j���������r|�������������������������������������i�|�_��������i�|�_��������g�|�_��������g�|�_��������i�|�_��������i�|�_��������i�|�_ ��������g�|�_ ��������d�S��N)�option_table�option_index�_build_index�alias�negative_alias� short_opts� long_opts� short2long� attr_name� takes_arg�option_order��selfr ���s��� �=/opt/alt/python311/lib64/python3.11/distutils/fancy_getopt.py�__init__zFancyGetopt.__init__)���s{�������)���������� ���������� ��!������������������� ����������c������������������l�����|�j���������������������������������������������|�j��������D�]}||�j���������|d���������<����d�S�)Nr���)r����clearr ���)r����options��� r���r���zFancyGetopt._build_indexQ���sG����������!�!�!��'�� 2�� 2�F�+1�D��f�Q�i�(�(� 2�� 2r���c������������������<�����||�_���������|�������������������������������������d�S�r ���)r ���r���r���s��� r����set_option_tablezFancyGetopt.set_option_tableV���s"������(����������r���c�����������������������||�j���������v�rt����������d|z���������������|||f}|�j�����������������������������|�������������||�j���������|<���d�S�)Nz'option conflict: already an option '%s')r����DistutilsGetoptErrorr ����append)r����long_option�short_option�help_stringr���s��� r���� add_optionzFancyGetopt.add_optionZ���se�������$�+�+�+�&�;�k�I�K��K�� K��"�<��=�F���$�$�V�,�,�,�-3�D��k�*�*�*r���c�����������������������||�j���������v�S�)zcReturn true if the option table for this parser has an option with long name 'long_option'.)r����r���r"���s��� r���� has_optionzFancyGetopt.has_optionc���s��������d�/�/�/r���c������������������6�����|����������������������t����������������������S�)z�Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.�� translate� longopt_xlater'���s��� r���� get_attr_namezFancyGetopt.get_attr_nameh���s��������$�$�]�3�3�3r���c����������� �������������|������������������������������������D�]I\��}}||�j��������vrt����������d|�d|�d|�d��������������||�j��������vrt����������d|�d|�d|�d���������������Jd�S�)Nzinvalid z 'z': option 'z ' not defined�': aliased option ')�itemsr���r ���)r����aliases�whatr ����opts��� r����_check_alias_dictzFancyGetopt._check_alias_dictn���s�������#�M�M�O�O�� P�� P�L�U�C��D�-�-�-�*�*�59�T�T�5�5�5�%�%�%�,I��J��J��J��$�+�+�+�*�*�=A�T�T�5�5�5�#�#�#�,O��P��P��P��,� P�� Pr���c������������������@�����|�����������������������|d�������������||�_��������dS�)z'Set the aliases for this option parser.r ���N)r4���r ���)r���r ���s��� r����set_aliaseszFancyGetopt.set_aliasesx���s#���������u�g�.�.�.��� � � r���c������������������@�����|�����������������������|d�������������||�_��������dS�)z�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.znegative aliasN)r4���r���)r���r���s��� r����set_negative_aliasesz FancyGetopt.set_negative_aliases}���s)������ � ���~�/?�@�@�@�,����r���c����������������������g�|�_���������g�|�_��������|�j��������������������������������������������i�|�_��������|�j��������D��]$}t ����������|������������dk����r |\��}}}d}n-t ����������|������������dk����r|\��}}}}nt����������d|���������������t����������|t����������������������rt ����������|������������dk�����rt����������d|z���������������|�:t����������|t����������������������rt ����������|������������dk����st����������d |z���������������||�j��������|<���|�j������������������������������|�������������|d ���������dk����r|r|dz���}|dd ����������}d|�j��������|<���nS|�j �����������������������������|������������}|�-|�j��������|���������rt����������d |�d|�d��������������||�j���������d <���d|�j��������|<���|�j�����������������������������|������������}|�2|�j��������|���������|�j��������|���������k����rt����������d|�d|�d��������������t �������������������������������|������������st����������d|z���������������|����������������������|������������|�j��������|<���|r*|�j�����������������������������|�������������||�j��������|d���������<�����&dS�)z�Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. ����r�������zinvalid option tuple: ����z9invalid long option '%s': must be a string of length >= 2N����z:invalid short option '%s': must a single character or None����=�:zinvalid negative alias 'r/���z' takes a valuezinvalid alias 'z%': inconsistent with aliased option 'z/' (one of them takes a value, the other doesn'tzEinvalid long option name '%s' (must be letters, numbers, hyphens only)r���r���r���r����repeatr ����len� ValueError� isinstance�strr ���r!���r���r����getr ���� longopt_re�matchr-���r���)r���r����long�short�helprA����alias_tos��� r����_grok_option_tablezFancyGetopt._grok_option_table����s������ ������������������'��A 1��A 1�F��6�{�{�a���$*�!��e�T�����V����!�!�,2�)��e�T�6�6��!�j�v�v�!G�H�H�H���d�C�(�(�� B�C��I�I��M�M�*��-9�<@�,A��B��B��B���m� ���,�,��$�14�U���q���*��,9�;@�,A��B��B��B��!'�D�K����N�!�!�$�'�'�'��B�x�3����-�%�#�+�%��A�b�D�z��'(���t�$�$�� �.�2�2�4�8�8���'��~�h�/��2�2�2��"&���x�x�x�1�2��2��2� �*.�D�N�2�&�'(���t�$���z�~�~�d�+�+�H��#��>�$�'�4�>�(�+C�C�C�.�.��"�T�T�8�8�8�-�.��.��.���#�#�D�)�)�� I�*�A�CG�H�I��I��I��$(�#5�#5�d�#;�#;�D�N�4� ��� 1���&�&�u�-�-�-�,0����a��)��CA 1��A 1r���c������������������J����|�t�����������j��������dd����������}|�t������������������������}d}nd}|�������������������������������������d���������������������|�j��������������������} �t ����������j��������|||�j��������������������\��}}n&#�t����������j��������$�r}t����������|�������������d}~ww�xY�w|D�]�\��}}t����������|������������dk����r |d���������dk����r|�j��������|d������������������}n |dd����������}|�j��������� ��������������������|������������} | r| }|�j��������|���������s#|�j��������� ��������������������|������������} | r| }d}nd}|�j��������|���������} |r.|�j��������� ��������������������| �������������t%����������|| d������������dz���}t'����������|| |�������������|�j�����������������������������||f���������������|r||fS�|S�) a��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. Nr=���TF� r<���r���r���)�sys�argv�OptionDummyrM����joinr����getoptr����error�DistutilsArgErrorrB���r���r ���rF���r���r���r���rA����getattr�setattrr���r!���)r����args�object�created_objectr����opts�msgr3����valr ����attrs��� r���rT���zFancyGetopt.getopt����s��������<��8�A�B�B�<�D��>� �]�]�F�!�N�N�"�N����!�!�!��X�X�d�o�.�.� � )���t�Z���H�H�J�D�$�$���|�� )�� )�� )�#�C�(�(�(����� )������� 1�� 1�H�C���3�x�x�1�}�}��Q��3����o�c�!�f�-�����!�"�"�g���J�N�N�3�'�'�E��� ����>�#�&�� ��+�/�/��4�4������C��C�C��C��>�#�&�D���� 3�t�{���t�,�,�8��f�d�A�.�.��2���F�D�#�&�&�&���$�$�c�3�Z�0�0�0�0���� ���<���Ks����A:��:B� B�Bc������������������<�����|�j����������t����������d�������������|�j���������S�)z�Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet. Nz!'getopt()' hasn't been called yet)r����RuntimeError)r���s��� r����get_option_orderzFancyGetopt.get_option_order��s%������ ���$��B�C�C�C��$�$r���c����������������������d}|�j���������D�]A}|d���������}|d���������}t����������|������������}|d���������dk����r|dz ��}|�|dz���}||k����r|}�B|dz���dz���dz���}d}||z ��} d |z��} |r|g}nd g}|�j���������D�]�}|dd����������\��}}}t����������|| ������������} |d���������dk����r |dd����������}|�?| r"|���������������������d||| d���������fz���������������n_|���������������������d ||fz���������������nD|�d|�d�}| r"|���������������������d||| d���������fz���������������n|���������������������d|z���������������| dd����������D�]}|���������������������| |z�������������������|S�)z�Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object. r���r=���r>���r?���N����r<����N���rO���zOption summary:r:���z --%-*s %sz --%-*s z (-�)z --%-*s)r ���rB���� wrap_textr!���)r����header�max_optr���rI���rJ����l� opt_width� line_width� text_width� big_indent�linesrK����text� opt_namess��� r���� generate_helpzFancyGetopt.generate_help��s����������'�� �� �F��!�9�D��1�I�E��D� � �A��B�x�3�����E��� ���E���7�{�{�����a�K�!�O�a�'� �0�� ��)�+� ��9�_� ��� (��H�E�E�&�'�E��'�� -�� -�F� &�r��r� ��D�%���T�:�.�.�D��B�x�3����A�b�D�z����}���A��L�L��7�D�$�q�'�2J�!J�K�K�K�K��L�L���$��!?�@�@�@�@� �+/�$�$����6� ���9��L�L��")�9�d�1�g�!>�"?��@��@��@��@���L�L��i�!7�8�8�8��!�"�"�X�� -�� -�����Z�!�^�,�,�,�,� -��r���c�����������������������|�t�����������j��������}|����������������������|������������D�]}|���������������������|dz�����������������d�S�)N� )rP����stdoutrr����write)r���rh����file�lines��� r���� print_helpzFancyGetopt.print_helph��sN�������<��:�D��&�&�v�.�.�� $�� $�D��J�J�t�d�{�#�#�#�#� $�� $r���r ���)NN)�__name__� __module__�__qualname__�__doc__r���r���r���r%���r(���r-���r4���r6���r8���rM���rT���rb���rr���ry�����r���r���r���r������s������������� �� �&��&��&��&�P2��2��2� �����4��4��4��4�0��0��0� 4��4��4�P��P��P������ -��-��-�K1��K1��K1�Z;��;��;��;�z%��%��%�M��M��M��M�^$��$��$��$��$��$r���r���c������������������v�����t����������|�������������}|���������������������|�������������|���������������������||������������S�r ���)r���r8���rT���)�options�negative_optrZ���rY����parsers��� r����fancy_getoptr����o��s7������ �� !� !�F� ����-�-�-��=�=��v�&�&�&r���c������������������.�����i�|�]}t����������|������������d���S�)rO���)�ord)�.0�_wschars��� r���� <dictcomp>r����u��s ������@�@�@�7�C��L�L�3�@�@�@r���c����������������������|��g�S�t����������|�������������|k����r|�gS�|������������������������������������}�|����������������������t����������������������}�t ����������j��������d|�������������}d��|D���������������}g�}|r�g�}d}|r\t����������|d���������������������}||z���|k����r$|���������������������|d����������������������|d=�||z���}n|r|d���������d���������dk����r|d=�n|�\|rQ|dk����r6|���������������������|d���������d|�����������������������|d���������|d����������|d<���|d���������d���������dk����r|d=�|���������������������d���������������������|�������������������������|��|S�)z�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. Nz( +|-+)c�����������������������g�|�]}|�|��S�r~���r~���)r�����chs��� r���� <listcomp>zwrap_text.<locals>.<listcomp>���s������ (� (� (�R�R� (�b� (� (� (r���r���r>���rO�����)rB���� expandtabsr+����WS_TRANS�re�splitr!���rS���)rp����width�chunksro����cur_line�cur_lenrj���s��� r���rg���rg���w��s��������|�� � �4�y�y�E����v� ��?�?���D��>�>�(�#�#�D� �X�j�$� '� '�F� (� (�6� (� (� (�F��E� �� (������� ��F�1�I���A���{�e�#�#�����q� �*�*�*��1�I�!�A�+������%����Q��3� 6� 6� ������� ���� ���!�|�|�����q� �!�E�'� 2�3�3�3�"�1�I�e�f�f�-��q� � ��a�y��|�s�"�"��1�I�� ���R�W�W�X�&�&�'�'�'�A��� (�D��Lr���c������������������6�����|�����������������������t����������������������S�)zXConvert a long option name to a valid Python identifier by changing "-" to "_". r*���)r3���s��� r����translate_longoptr�������s��������=�=��'�'�'r���c�������������������������e�Zd�ZdZg�fd�ZdS�)rR���z_Dummy class just used as a place to hold command-line option values as instance attributes.c������������������2�����|D�]}t����������|�|d��������������dS�)zkCreate a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.N)rX���)r���r����r3���s��� r���r���zOptionDummy.__init__���s2��������� %�� %�C��D�#�t�$�$�$�$� %�� %r���N)rz���r{���r|���r}���r���r~���r���r���rR���rR������s7��������������&��&�� "��%��%��%��%��%��%r���rR����__main__z�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?"].))� ������������(���z width: %drt���)r}���rP����stringr����rT����distutils.errors�longopt_pat�compilerG����neg_alias_rerE���� maketransr,���r���r����� whitespacer����rg���r����rR���rz���rp����w�printrS���r~���r���r����<module>r�������s��������������������������������� � � � ����������+�� �R�Z��+�-� .� .� ���r�z�z�K�K�K����E�F�F���� � �c�3�'�'� �O$��O$��O$��O$��O$��O$��O$��O$�d '��'��'��A�@�f�.?�@�@�@��3��3��3�l(��(��(�%��%��%��%��%��%��%��%���z��� �D�������� ��k�A�o���� ��d�i�i� � �$��*�*�+�+�,�,�,� �����������r���