%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/babel/messages/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/babel/messages/__pycache__/frontend.cpython-312.pyc

�

ƪbC���h�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
m
Z
ddlmZddlmZddlmZmZdd	lmZdd
lmZmZddlmZmZmZmZddlm Z dd
l!m"Z"m#Z#ddl$m%Z%ejLd�Z'	ddl(m)Z*e'Z+	ddl,m-Z-m.Z.m/Z/d'd�Z8Gd�de*�Z)Gd�de)�Z9d�Z:Gd�de)�Z;d�Z<Gd�de)�Z=Gd�d e)�Z>Gd!�d"�Z?d#�Z@d'd$�ZAgfd%�ZBeCd&k(re@�yy#e0$r	e1xZ-xZ.Z/Y�rwxYw#e0$rddl2m'Z+ddl3m)Z*ddl4m5Z-m6Z.m7Z/Y��wxYw)(z�
    babel.messages.frontend
    ~~~~~~~~~~~~~~~~~~~~~~~

    Frontends for the message extraction functionality.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�OrderedDict)�RawConfigParser)�datetime)�StringIO)�__version__)�Locale�
localedata)�UnknownLocaleError)�Catalog�DEFAULT_HEADER)�DEFAULT_KEYWORDS�DEFAULT_MAPPING�check_and_call_extract_file�extract_from_dir)�write_mo)�read_po�write_po)�LOCALTZ�babel)�Command)�OptionError�
SetupError�	BaseError)�log)�DistutilsOptionError�DistutilsSetupError�DistutilsErrorc�>�g}t|ttf�s|g}|D]h}|��t|ttf�r|jt	||����9|jd�t|�j
|�D���jtd�|D��sJ�|S)a
    Make a list out of an argument.

    Values from `distutils` argument parsing are always single strings;
    values from `optparse` parsing may be lists of strings that may need
    to be further split.

    No matter the input, this function returns a flat list of whitespace-trimmed
    strings, with `None` values filtered out.

    >>> listify_value("foo bar")
    ['foo', 'bar']
    >>> listify_value(["foo bar"])
    ['foo', 'bar']
    >>> listify_value([["foo"], "bar"])
    ['foo', 'bar']
    >>> listify_value([["foo"], ["bar", None, "foo"]])
    ['foo', 'bar', 'foo']
    >>> listify_value("foo, bar, quux", ",")
    ['foo', 'bar', 'quux']

    :param arg: A string or a list of strings
    :param split: The argument to pass to `str.split()`.
    :return:
    )�splitc3�<K�|]}|j����y�w�N��strip)�.0�ss  �9/usr/lib/python3/dist-packages/babel/messages/frontend.py�	<genexpr>z listify_value.<locals>.<genexpr>Ys����<��1�7�7�9�<���c3�<K�|]}t|t����y�wr!)�
isinstance�str)r$�vals  r&r'z listify_value.<locals>.<genexpr>Zs����3��z�#�s�#�3�r()r*�list�tuple�extend�
listify_valuer+r�all)�argr�outr,s    r&r0r04s���4
�C��c�D�%�=�)��e���=���;���c�D�%�=�)��J�J�}�S��6�7���
�
�<�c�#�h�n�n�U�&;�<�<�
=��3�s�3�3�3�3��J�c�,�eZdZdZdZdZiZiZeZ	dd�Z
y)rN�c�x�||_|j�d|_d|_d|_d|_d|_y)NFr)�distribution�initialize_options�_dry_run�verbose�force�help�	finalized)�self�dists  r&�__init__zCommand.__init__|s9�� ������!���
������
���	���r4r!)�__name__�
__module__�__qualname__�as_args�multiple_value_options�boolean_options�option_aliases�option_choices�
distutils_logrrAr6r4r&rr^s2��
�G� ���O��N��N��C�r4rc�<�eZdZdZdZgd�ZddgZd�Zd�Zd�Z	d	�Z
y
)�compile_cataloga�Catalog compilation command for use in ``setup.py`` scripts.

    If correctly installed, this command is available to Setuptools-using
    setup scripts automatically. For projects using plain old ``distutils``,
    the command needs to be registered explicitly in ``setup.py``::

        from babel.messages.frontend import compile_catalog

        setup(
            ...
            cmdclass = {'compile_catalog': compile_catalog}
        )

    .. versionadded:: 0.9
    z+compile message catalogs to binary MO files))�domain=�Dz>domains of PO files (space separated list, default 'messages'))z
directory=�d�.path to base directory containing the catalogs�zinput-file=�izname of the input file)�output-file=�ozQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.mo')��locale=�lz locale of the catalog to compile)�	use-fuzzy�fzalso include fuzzy translations)�
statisticsNz#print statistics about translationsrXrZc�f�d|_d|_d|_d|_d|_d|_d|_y�N�messagesF)�domain�	directory�
input_file�output_file�locale�	use_fuzzyrZ�r?s r&r9z"compile_catalog.initialize_options�s4�� ��������������������r4c���t|j�|_|js|jst	d��|j
s|jst	d��yy)Nz<you must specify either the input file or the base directoryz=you must specify either the output file or the base directory)r0r^r`r_rrards r&�finalize_optionsz compile_catalog.finalize_options�sN��#�D�K�K�0������t�~�~��\�]�]��������]�^�^�)7�r4c���d}|jD]7}|j|�j�D]\}}|t|�z
}��9|r|jjd|z�|rdSdS)Nrz%d errors encountered.�)r^�_run_domain�items�lenr�error)r?�n_errorsr^�catalog�errorss     r&�runzcompile_catalog.run�sw�����k�k�	(�F�#'�#3�#3�F�#;�#A�#A�#C�
(�����C��K�'��
(�	(���H�H�N�N�3�h�>�?���%�1�%r4c
��g}g}|j�so|jr�|j|jtjj|j|jd|dz�f�|jtjj|j|jd|dz���n\tj|j�D]�}tjj|j|d|dz�}tjj|�s�R|j||f�|jtjj|j|d|dz����n�|j|j|jf�|jr|j|j�nH|jtjj|j|jd|dz��|std��i}t|�D�]~\}\}}||}t|d�5}	t|	|�}
ddd�|jrmd}t
�ddD]}|j s�|dz
}�d}
t#|
�r|dzt#|
�z}
|j$j'd	|t#|
�|
|�
j(r)|j*s|j$j'd
|���t|
j-��x||
<}|D]4\}}|D]*}|j$j/d||j0|��,�6|j$j'd||�t|d
�5}t3||
|j*��ddd����|S#1swY��^xYw#1swY���xYw)N�LC_MESSAGES�.poz.mo�no message catalogs found�rbrrh�dz)%d of %d messages (%d%%) translated in %sz'catalog %s is marked as fuzzy, skippingzerror: %s:%d: %szcompiling catalog %s to %s�wb)rc)r`rb�append�os�path�joinr_�listdir�existsrar�	enumerate�openrrZr-�stringrkr�info�fuzzyrc�checkrl�linenor)r?r^�po_files�mo_filesrb�po_file�catalogs_and_errors�idx�mo_file�infilern�
translated�message�
percentage�catalog_errorsrorl�outfiles                  r&rizcompile_catalog._run_domain�sG����������{�{�������!#�����d�n�n�d�k�k�.;�.4�u�n�">�!?�@���������T�^�^�T�[�[�-:�-3�e�^�!=�>�!�j�j����8�F�F� �g�g�l�l�4�>�>�6�+8�&�5�.�J�G��w�w�~�~�g�.� �����(9�:� ��������T�^�^�V�5B�5;�e�^�)E�F�F�
�O�O�T�[�[�$�/�/�:�;�������� 0� 0�1���������T�^�^�T�[�[�-:�-3�e�^�!=�>���9�:�:� ��&/��&9� 	E�"�C�"�&�'��s�m�G��g�t�$�
2��!�&�&�1��
2�����
�#�G�}�Q�R�0�(�G��~�~�"�a��
�(��
��w�<�!+�c�!1�S��\�!A�J����
�
�?���G��j�'��
�}�}�T�^�^����
�
�G��Q��<@�����<Q�Q���(�>�#1�
����#��E��H�H�N�N�*�G�W�^�^�U���
�
�H�H�M�M�6���I��g�t�$�
E����'�T�^�^�D�
E�
E�? 	E�D#�"�A
2�
2��:
E�
E�s�

N6�O�6O	�O
	N)rBrCrD�__doc__�description�user_optionsrGr9rfrprir6r4r&rLrL�s8��� @�K��L�"#�L�1�O� �_�&�F#r4rLc����fd�}|S)zO
    Build a directory_filter function based on a list of ignore patterns.
    c�n���tjj|��t�fd��D��S)Nc3�J�K�|]}tj�|����y�wr!)�fnmatch)r$�ignore_pattern�basenames  �r&r'zG_make_directory_filter.<locals>.cli_directory_filter.<locals>.<genexpr>s$�����
��
�O�O�H�n�5�
�s� #)ryrzr��any)�dirnamer��ignore_patternss @�r&�cli_directory_filterz4_make_directory_filter.<locals>.cli_directory_filters8����7�7�#�#�G�,���
��
�
�
�	
r4r6)r�r�s` r&�_make_directory_filterr�s���
� �r4c�Z�eZdZdZdZgd�Zgd�ZdZdZddd	d
d�Z	dd
iZ
d�Zd�Zd�Z
d�Zy)�extract_messagesa�Message extraction command for use in ``setup.py`` scripts.

    If correctly installed, this command is available to Setuptools-using
    setup scripts automatically. For projects using plain old ``distutils``,
    the command needs to be registered explicitly in ``setup.py``::

        from babel.messages.frontend import extract_messages

        setup(
            ...
            cmdclass = {'extract_messages': extract_messages}
        )
    z1extract localizable strings from the project code))zcharset=Nz3charset to use in the output file (default "utf-8"))z	keywords=�kzispace-separated list of keywords to look for in addition to the defaults (may be repeated multiple times))�no-default-keywordsNz#do not include the default keywords)z
mapping-file=�Fz&path to the mapping configuration file)�no-locationNz>do not include location comments with filename and line number)z
add-location=Nz�location lines format. If it is not given or "full", it generates the lines with both file name and line number. If it is "file", the line number part is omitted. If it is "never", it completely suppresses the lines (same as --no-location).)�omit-headerNz'do not include msgid "" entry in header)rSrTzname of the output file�zwidth=�wz"set output line width (default 76)��no-wrapNzVdo not break long message lines, longer than the output line width, into several lines)�sort-outputNz&generate sorted output (default False))�sort-by-fileNz,sort output by file location (default False))zmsgid-bugs-address=Nzset report address for msgid)zcopyright-holder=Nzset copyright holder in output)zproject=Nzset project name in output)zversion=Nzset project version in output)z
add-comments=�czuplace comment block with TAG (or those preceding keyword lines) in output file. Separate multiple TAGs with commas(,))�strip-commentsr%z)strip the comment TAGs from the comments.)zinput-paths=Nzofiles or directories that should be scanned for messages. Separate multiple files or directories with commas(,))zinput-dirs=Nz@alias for input-paths (does allow files as well as directories).)zignore-dirs=NzwPatterns for directories to ignore when scanning for messages. Separate multiple patterns with spaces (default ".* ._"))zheader-comment=Nzheader comment for the catalog)r�r�r�r�r�r�r�zinput-paths)zadd-comments�keywordszignore-dirs)z	--keyword)z	--mapping)z--output)z--strip-comment-tags)r�zmapping-filezoutput-filer�zadd-location)�full�file�neverc�F�d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_d|_y)Nzutf-8FT)�charsetr��no_default_keywords�mapping_file�no_location�add_location�omit_headerra�
input_dirs�input_paths�width�no_wrap�sort_output�sort_by_file�msgid_bugs_address�copyright_holder�project�version�add_comments�strip_comments�include_lineno�ignore_dirs�header_commentrds r&r9z#extract_messages.initialize_optionsvs��������
�#(�� � ��� ��� ��� ��������������
���� ���!���"&��� $��������� ���#���"������"��r4c	��|jr)|js|j|_ntd��|jri}nt	j
�}|j
tt|j���||_	|jstd��|jstd��|jr|jrtd��|js|jsd|_n&|j�t|j�|_|jr|jrtd��|jr@t!|jt"�r�t%j&d|j�|_nu|j(�bt*j-|j(j.xsdD�cgc]}|j'd	d
�d��c}�j1�|_ng|_|jstd��|jD]/}t2j4j7|�r�#td
|z��t|j8xsdd�|_|j(rV|j:s|j(j=�|_|j>s|j(jA�|_|jBdk(rd|_"n|jBdk(rd|_#t|jH�}|rtK|jH�|_&yd|_&ycc}w)Nz1input-dirs and input-paths are mutually exclusivez=you must specify new keywords if you disable the default oneszno output file specified�0'--no-wrap' and '--width' are mutually exclusive�Lz;'--sort-output' and '--sort-by-file' are mutually exclusivez,\s*r6�.rhrz'no input files or directories specifiedzInput path: %s does not exist�,r�Tr�F)'r�r�rr�r
�copy�update�parse_keywordsr0r�rar�r��intr�r�r*r+�rerr8�dict�fromkeys�packages�keysryrzr}r�r��get_namer��get_versionr�r�r�r�r��directory_filter)r?r�r�rzr�s     r&rfz!extract_messages.finalize_options�s����?�?��#�#�#'�?�?�� �!�G����#�#��H�'�,�,�.�H�����}�T�]�]�'C�D�E� ��
��}�}��O��
�����8�9�9��<�<�D�J�J��B��
��|�|�D�J�J��D�J�
�Z�Z�
#��T�Z�Z��D�J����� 1� 1��M��
�����$�*�*�C�0�#%�8�8�G�T�5E�5E�#F�� �
�
�
�
*�#�}�}��+�+�4�4�:��.������Q���"�.� ��t�v�
��
 "�D������G�H�H��$�$�	J�D��7�7�>�>�$�'�!�"A�D�"H�I�I�	J�*�$�*;�*;�*A�r�3�G�������<�<�#�0�0�9�9�;����<�<�#�0�0�<�<�>�������'�#�D��
�
�
�&�
(�"'�D��#�D�$4�$4�5���$:�4�;K�;K�$L�D�!�$(�D�!��?.s�
Mc�����j�}t�jd�5}t�j�j
�j�j�j�jxst��}|D�]1\�}}��fd�}tjj��rEtj�}t�|||�j �j"�j$|�}n;t'�||�j �j"|�j$�j(��}|D]�\}	}
}}}
tjj��r|	}n=tjj+tjj-�|	��}|j/|d||
fg||
������4�j0j3d�j�t5||�j6�j8�j:�j<�j>�j@��ddd�y#1swYyxYw)Nrw)r�r�r�r�r�r�c���|dk(rytjj��r�}n=tjjtjj	�|��}d}|r;ddj	|j�D��cgc]
\}}|�d|�d���c}}�z}�jjd||�ycc}}w)N�ignore�z (%s)z, z="�"zextracting messages from %s%s)ryrz�isfile�normpathr{rjrr�)	�filename�method�options�filepath�optstrr��vrzr?s	       ��r&�callbackz&extract_messages.run.<locals>.callback�s������)���w�w�~�~�d�+�#'��#%�7�7�#3�#3�B�G�G�L�L��x�4P�#Q���F��!(�4�9�9�>E�m�m�o�6O�6:�a��DE�a�6H�6O�,P�"P���H�H�M�M�"A�8�V�T��6Os�
C)r��comment_tagsr��strip_comment_tagsr�)�
auto_comments�contextzwriting PO template file to %s)r�r�r�r�r�r�)!�
_get_mappingsrrarr�r�r�r�r�r�rryrzr��getcwdrr�r�r�rr�r�r{�addrr�rr�r�r�r�r�r�)r?�mappingsr�rn�
method_map�options_mapr��current_dir�	extractedr�r�r��commentsr�r�rzs`              @r&rpzextract_messages.run�s�����%�%�'��
�$�"�"�D�
)�;	9�W��d�l�l�&*�l�l�15�1H�1H�/3�/D�/D�&*�l�l�.2�.A�.A�.S�^�V�G�2:�+
I�-��j�+�U�&�7�7�>�>�$�'�"$�)�)�+�K� ;��j�+� �$�-�-��1B�1B��+�+�[�!�I�!1��j�+�!%���%)�%6�%6�!)�+/�+>�+>�)-�)>�)>�
!�I�EN�I�@�H�f�g�x���w�w�~�~�d�+�#+��#%�7�7�#3�#3�B�G�G�L�L��x�4P�#Q���K�K����6�0B�/C�.6�� �I�
I�I+
I�Z
�H�H�M�M�:�D�<L�<L�M��W�g�T�Z�Z�!%�!1�!1�!%�!1�!1�!%�!1�!1�"&�"3�"3�$(�$7�$7�
9�m;	9�;	9�;	9�s�HH4�4H=c��g}|jrSt|j�5}t|�\}}ddd�|jD]}|j	|f��|St|jdd�r�|jj}|j�D]l\}}t|t�rtt|��\}}n+gi}}|D]"\}}	}
|j	||	f�|
xsi||<�$|j	|||f��n|S|jD]}|j	|tif��|S#1swY��
xYw)N�message_extractors)
r�r�
parse_mappingr�rx�getattrr8r�rjr*r+rr)r?r��fileobjr�r�rzr��mapping�patternr�r�s           r&r�zextract_messages._get_mappingssi��������d�'�'�(�
A�G�*7��*@�'�
�K�
A��(�(�
A������z�;� ?�@�
A�&��!�T�&�&�(<�d�
C�!%�!2�!2�!E�!E��!3�!9�!9�!;�
A�
��g��g�s�+�.;�H�W�<M�.N�+�J��.0�"��J�4;�=�0����"�)�)�7�F�*;�<�/6�}�"��G�,�=�����z�;� ?�@�
A����(�(�
=�������� ;�<�
=���+
A�
A�s�D;�;EN)rBrCrDr�r�r�rGrErFrHrIr9rfrpr�r6r4r&r�r�sh���F�K�5�L�l�O��G���#�&�$�3�	�N�	�2��N�#�2J)�X=9�~r4r�c�H�|dk(sJ�t|t�std��y)agValidate the ``message_extractors`` keyword argument to ``setup()``.

    :param dist: the distutils/setuptools ``Distribution`` object
    :param name: the name of the keyword argument (should always be
                 "message_extractors")
    :param value: the value of the keyword argument
    :raise `DistutilsSetupError`: if the value is not valid
    r�zDthe value of the "message_extractors" parameter must be a dictionaryN)r*r�r)r@�name�values   r&�check_message_extractorsr�6s4���'�'�'�'��e�T�"��
-�
�	
�#r4c�4�eZdZdZdZgd�ZdgZd�Zd�Zd�Z	y)	�init_cataloga�New catalog initialization command for use in ``setup.py`` scripts.

    If correctly installed, this command is available to Setuptools-using
    setup scripts automatically. For projects using plain old ``distutils``,
    the command needs to be registered explicitly in ``setup.py``::

        from babel.messages.frontend import init_catalog

        setup(
            ...
            cmdclass = {'init_catalog': init_catalog}
        )
    z(create a new catalog based on a POT file)�rMrNz&domain of PO file (default 'messages')rQ)�output-dir=rOzpath to output directory�rSrTzQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.po'))rVrWz$locale for the new localized catalogr�r�r�c�f�d|_d|_d|_d|_d|_d|_d|_yr\)�
output_dirrar`rbr^r�r�rds r&r9zinit_catalog.initialize_optionsks4�������������� ��������
r4c��|jstd��|jstd��	tj|j�|_|js|jstd��|jsHtjj|j|jd|jdz�|_tjjtjj|j��s<tjtjj|j��|j r|j"rtd��|j s|j"sd|_y|j"�t%|j"�|_yy#t$r}t|�|�d}~wwxYw)N�you must specify the input filez-you must provide a locale for the new catalogz%you must specify the output directoryrrrsr�r�)r`rrbr�parse�_localer
rarryrzr{r^r}r��makedirsr�r�r��r?�es  r&rfzinit_catalog.finalize_optionstsD������?�@�@��{�{��M�N�N�	(�!�<�<����4�D�L��������E�F�F����!�w�w�|�|�D�O�O�T�[�[�,9�4�;�;��;N� P�D���w�w�~�~�b�g�g�o�o�d�.>�.>�?�@��K�K�������(8�(8�9�:��<�<�D�J�J��P�Q�Q��|�|�D�J�J��D�J�
�Z�Z�
#��T�Z�Z��D�J�$��"�	(��a�.�a�'��	(�s�$F8�8	G�G
�
Gc���|jjd|j|j�t	|jd�5}t||j��}ddd�|j_tjt�|_d|_t	|jd�5}t|||j��ddd�y#1swY�wxYw#1swYyxYw)N�creating catalog %s based on %sru�rbFrw)r�)rr�rar`rrrbr	r�nowr�
revision_dater�rr�)r?r�rnr�s    r&rpzinit_catalog.run�s������
�
�-�t�/?�/?����	
��$�/�/�4�
(�	:�F��f�T�[�[�9�G�	:�
����� (���W� 5�����
�
�$�"�"�D�
)�	9�W��W�g�T�Z�Z�8�	9�	9�	:�	:��	9�	9�s�C�4C"�C�"C+N�
rBrCrDr�r�r�rGr9rfrpr6r4r&rrGs-���=�K��L�$!�k�O��)�49r4rc�6�eZdZdZdZgd�Zgd�Zd�Zd�Zd�Z	y)	�update_cataloga�Catalog merging command for use in ``setup.py`` scripts.

    If correctly installed, this command is available to Setuptools-using
    setup scripts automatically. For projects using plain old ``distutils``,
    the command needs to be registered explicitly in ``setup.py``::

        from babel.messages.frontend import update_catalog

        setup(
            ...
            cmdclass = {'update_catalog': update_catalog}
        )

    .. versionadded:: 0.9
    z'update message catalogs from a POT file)rrQ)rrOrPr)r�Nz%do not include msgid  entry in headerrUr�r�)zignore-obsolete=Nz1whether to omit obsolete messages from the output)z
init-missing=Nz6if any output files are missing, initialize them first)�no-fuzzy-matching�Nzdo not use fuzzy matching)�update-header-commentNzupdate target header comment)�previousNz+keep previous msgids of translated messages)zcheck=Nz�don't update the catalog, just return the status. Return code 0 means nothing would change. Return code 1 means that the catalog would be updated)r�r�zignore-obsoletezinit-missingrrrr�c���d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
yr\)r^r`rrar�rbr�r��ignore_obsolete�init_missing�no_fuzzy_matching�update_header_commentrr�rds r&r9z!update_catalog.initialize_options�sj�� ������������ ��������
����$���!���!&���%*��"���
���
r4c��|jstd��|js|jstd��|jr|jstd��|j
r=|jstd��	t
j|j�|_nd|_|jr|jrtd��|js|jsd|_n&|j�t|j�|_|jr|jrd|_yyy#t$r}t|�|�d}~wwxYw)Nrz-you must specify the output file or directoryzyou must specify the localez?you must specify the locale for the init-missing option to workr�r�F)r`rrarrbrrrr	r
r�r�r�rrrs  r&rfzupdate_catalog.finalize_options�s������?�@�@��������M�N�N����D�K�K��;�<�<�����;�;�!�6���

,�%�|�|�D�K�K�8��� �D�L��<�<�D�J�J��P�Q�Q��|�|�D�J�J��D�J�
�Z�Z�
#��T�Z�Z��D�J��!�!�d�m�m�!�D�M�'4�!��&�
,�!�!�n�!�+��
,�s�$D9�9	E�E�Ec
���i}g}|js�|jr_|j|jtjj|j|jd|jdz�f�n�tj|j�D]n}tjj|j|d|jdz�}tjj|�s�\|j||f��pn'|j|j|jf�|std��|j}|sItjjtjj|j��d}t|jd�5}t|�}ddd�|D�]�\}}|j r�tjj|�s�|j"rd||<�D|j$j'd||j�t|jd�5}t||j��}	ddd�|j(	_t+j,t.�|	_d|	_t|d	�5}
t5|
|	�ddd�|j$j'd
||j�t|d�5}t|||��}	ddd�	j7|j8|j:��tjjtjj=|�t?j@�tjj|�z�}	t|d	�5}t5||	|jB|jD|jF|jH�
�ddd�|j"r|t|d�5}
t|
�}ddd�t|d�5}t|�}ddd�j0_|jM|�||<tjJ|����	tjN||����|j"r�|jW�D]@\}}|r|j$j'd|��%|j$jYd|��Bt[|j]��st_d��|j$j'd�yy#1swY��vxYw#1swY���xYw#1swY���xYw#1swY��YxYw#1swY���xYw#tjJ|��xYw#1swY��|xYw#1swY��ixYw#tP$rDtjJ|�tSjT||�tjJ|�Y��,wxYw)NrrrsrtrruFrrrwzupdating catalog %s based on %s)rbr^)r)r�r�include_previousr�zCatalog %s is up to date.zCatalog %s is out of date.zSome catalogs are out of date.z All the catalogs are up-to-date.)0rarbrxryrzr{rr^r|r}r�splitextr�r`rrrr�rr�r	rrrrr�rr�rrr��tempfile�
gettempprefixr�rrr��remove�is_identical�rename�OSError�shutilr�rj�warningr1�valuesr)r?�check_statusr�rbr�r^r��templater�rnr��tmpname�tmpfile�origfile�original_catalog�newfile�updated_catalog�
up_to_dates                  r&rpzupdate_catalog.run	s�����������{�{�������!#�����d�o�o�t�{�{�.;�.2�k�k�E�.A�"C�!D�E�
!�j�j����9�;�F� �g�g�l�l�4�?�?�F�+8�+/�;�;��+>�@�G��w�w�~�~�g�.� �����(9�:�;�
�O�O�T�[�[�$�*:�*:�;�<���9�:�:�������W�W�%�%�b�g�g�&6�&6�t���&G�H��K�F�
�$�/�/�4�
(�	'�F��v��H�	'�!)�?	#��F�H�� � �������)A��:�:�-2�L��*�����
�
�5�x������$�/�/�4�0�B�F�&�f�T�[�[�A�G�B�
"&�����(0���W�(=��%� %��
��(�D�)�/�W��W�g�.�/�
�H�H�M�M�;�X�t���W��h��%�
H��!�&���G��
H�
�N�N��$�0�0�&*�&@�&@�
�
�
�g�g�l�l�2�7�7�?�?�8�#<�#+�#9�#9�#;�#%�7�7�#3�#3�H�#=�$>�?�G�
��'�4�(�O�G��W�g�)-�)9�)9�-1�-A�-A�.2�m�m�4�:�:�O�O��z�z��(�D�)�9�X�'.�x�'8�$�9��'�4�(�7�G�&-�g�&6�O�7�0@�0N�0N��-�)8�)E�)E�FV�)W��X�&��	�	�'�"��

#��	�	�'�8�,�m?	#�B�:�:�(4�(:�(:�(<�
M�$��*���H�H�M�M�"=�x�H��H�H�$�$�%A�8�L�	
M�
�|�*�*�,�-�� @�A�A����
�
�@�A���I	'�	'��B�B��/�/��
H�
H��O�O��

��	�	�'�"���9�9��7�7���
#��	�	�(�#����G�X�.��	�	�'�"�
#�s�.T.�T;�'
U�/U�U/�*:U"�$U/�V
�$V�5V$�.T8�;U	�U	�U	�"U,	�'U/�/V�
V	�V!	�$A	W1�0W1Nrr6r4r&rr�s-��� <�K�!�L�D�O�� "�>hr4rc�X�eZdZdZdZdezZddddd�Zee	e
ed�Zd	Z
dd
�Zd�Zd�Zd
�Zy	)�CommandLineInterfacez�Command-line interface.

    This class provides a simple command-line interface to the message
    extraction and PO file generation functionality.
    z%%prog %s [options] %sz	%%prog %sz$compile message catalogs to MO filesz:extract messages from source files and generate a POT filez+create new message catalogs from a POT filez0update existing message catalogs from a POT file)�compile�extract�initr�Nc��|�tj}tj|jdz|j
��|_|jj�|j|j_	|jjdddd��|jjd	d
ddtjd
��|jjddddtjd��|jjdtj��|jj!|dd�\}}|j#|j$�|j&rut)j*�}t-d�|D��}|j/�d|dzz}|D]1}t1j2|�}t5|||j6fz��3y|s|jj9d�|d}	|	|j:vr|jj9d|	z�|j=|	|dd�}
|
j?�S)z{Main entry point of the command-line interface.

        :param argv: list of arguments passed on the command-line
        N)�commandz[args])�usager�z--list-locales�list_locales�
store_truez print all known locales and exit)�dest�actionr=z-vz	--verbose�store_const�loglevelzprint as much as possible)r?r>�constr=z-qz--quietzprint as little as possibleF)r<rArhc3�2K�|]}t|����y�wr!�rk)r$�
identifiers  r&r'z+CommandLineInterface.run.<locals>.<genexpr>�s����H�j�#�j�/�H���z
%%-%ds %%srzQno valid command or option passed. Try the -h/--help option for more information.zunknown command "%s") �sys�argv�optparse�OptionParserr;r��parser�disable_interspersed_args�_help�
print_help�
add_option�logging�DEBUG�ERROR�set_defaults�INFO�
parse_args�_configure_loggingrAr<r	�locale_identifiers�max�sortrr�print�english_namerl�commands�_configure_commandrp)r?rHr��args�identifiers�longest�formatrErb�cmdname�cmdinsts           r&rpzCommandLineInterface.run�s���<��8�8�D��+�+�$�*�*�?T�2T�48�L�L�B������-�-�/�!%������������/�n�&2�$F�	�	H�	
�����t�[��$.�g�m�m�$?�	�	A�	
�����t�Y�}�$.�g�m�m�$A�	�	C�	
��� � �e�g�l�l� �K����.�.�t�A�B�x�8�
������� 0� 0�1����$�7�7�9�K��H�K�H�H�G�����"�g��k�2�F�)�
B�
����j�1���f�
�F�,?�,?�@�@�A�
B����K�K���O�
P��q�'���$�-�-�'��K�K���4�w�>�?��)�)�'�4���8�<���{�{�}�r4c�|�t|_|jj|�|jjr|jjd}n/tj�}|jj|�|j|�tjd�}|j|�y)Nrz%(message)s)r�setLevel�handlersrP�
StreamHandler�
addHandler�	Formatter�setFormatter)r?rA�handler�	formatters    r&rVz'CommandLineInterface._configure_logging�s�����������(�#��8�8����h�h�'�'��*�G��+�+�-�G��H�H����(�����"��%�%�m�4�	����Y�'r4c�6�t|jj��td�td�|jD��}dtd|dz�z}t|jj
��}|D]\}}t|||fz��y)Nz	commands:c3�2K�|]}t|����y�wr!rD)r$r:s  r&r'z-CommandLineInterface._help.<locals>.<genexpr>�s����@�w�c�'�l�@�rFz  %%-%ds %%s�rh)rZrK�format_helprXr\�sortedrj)r?r`rar\r�r�s      r&rMzCommandLineInterface._help�s���
�d�k�k�%�%�'�(�
�k���@�$�-�-�@�@���#�a��1��"5�5���$�-�-�-�-�/�0��!)�	0��D�+��&�D�+�.�.�/�	0r4c��|j|}|�}|jr|j|_t|t�sJ�|j	�tj|j|dfz|j|��}t|dd�}|jD�]\}}}	|jd�}
t||
jdd��}d|
zg}|r|jd	|z�|j|jj!|
d��|j"j!|
d
�}
|
|k(r|xjd|
zz
c_��|
|j$vr|j&|d|	d
����|
|j(vr|j&|d|	|
d����|j&||	||
d����|j+|�\}}|rt-||jdd�|�t/|�j1�D]\}}t-|||��	|j3�|S#t4$r%}|j7t9|��Yd
}~|Sd
}~wwxYw)zB
        :type cmdname: str
        :type argv: list[str]
        r�)r;r�rEr6�=�-�_z--%sz-%sNz<%s>r=)r?r=rx)r?r=�choices)r=�defaultrv)�command_classesrr*rr9rIrJr;r\r�r�r#�replacerxr/rH�getrIrGrOrFrU�setattr�varsrj�ensure_finalizedrrlr+)r?rbrH�cmdclassrcrKrE�long�shortr=r�rw�strsrvr�r^�keyr��errs                   r&r]z'CommandLineInterface._configure_command�s/��
�'�'��0���*���8�8��(�(�G�K��'�7�+�+�+��"�"�$��&�&��*�*���}�,��
�
�g�.�
���(�I�r�2��!)�!6�!6�	V��D�%���:�:�c�?�D��g�t�|�|�C��'=�>�G��T�M�?�D�����E�E�M�*��K�K��/�/�3�3�D�"�=�>��-�-�1�1�$��=�G��w�������
�-����1�1�1�!��!�!�4��4�H���8�8�8�!��!�!�4��t�W�U�!��!�!�4�d�G�W�U�	V� �)�)�$�/�
�����G�W�_�_�S�#�6��=��w�-�-�-�/�	)�J�C���G�S�%�(�	)�	#��$�$�&�����	#��L�L��S��"�"����	#�s�H(�(	I�1I�Ir!)rBrCrDr�r;�VERSIONr�r\rLr�rrrxrrprVrMr]r6r4r&r5r5ts\���
%�E��G�#�G�9�O�=�D�	�H�#�#�� �	�O��C�.�`
(�0�.r4r5c�P�t�jtj�Sr!)r5rprGrHr6r4r&�mainr�s���!�%�%�c�h�h�/�/r4c���i}g}i}t�}t|j�|_|j||�|j	�D]n}|dk(rt|j
|��}�#d�|jdd�D�\}}|j||f�t|j
|��||<�p|r&t|�D]\}	\}}||vr||}||f||	<�||fS)aParse an extraction method mapping from a file-like object.

    >>> buf = StringIO('''
    ... [extractors]
    ... custom = mypackage.module:myfunc
    ...
    ... # Python source files
    ... [python: **.py]
    ...
    ... # Genshi templates
    ... [genshi: **/templates/**.html]
    ... include_attrs =
    ... [genshi: **/templates/**.txt]
    ... template_class = genshi.template:TextTemplate
    ... encoding = latin-1
    ...
    ... # Some custom extractor
    ... [custom: **/custom/*.*]
    ... ''')

    >>> method_map, options_map = parse_mapping(buf)
    >>> len(method_map)
    4

    >>> method_map[0]
    ('**.py', 'python')
    >>> options_map['**.py']
    {}
    >>> method_map[1]
    ('**/templates/**.html', 'genshi')
    >>> options_map['**/templates/**.html']['include_attrs']
    ''
    >>> method_map[2]
    ('**/templates/**.txt', 'genshi')
    >>> options_map['**/templates/**.txt']['template_class']
    'genshi.template:TextTemplate'
    >>> options_map['**/templates/**.txt']['encoding']
    'latin-1'

    >>> method_map[3]
    ('**/custom/*.*', 'mypackage.module:myfunc')
    >>> options_map['**/custom/*.*']
    {}

    :param fileobj: a readable file-like object containing the configuration
                    text to parse
    :see: `extract_from_directory`
    �
extractorsc3�<K�|]}|j����y�wr!r")r$�parts  r&r'z parse_mapping.<locals>.<genexpr>Gs����N��t�z�z�|�N�r(�:rh)
rr�	_sections�	read_file�sectionsr�rjrrxr~)
r�r�r�r�r�rK�sectionr�r�r�s
          r&r�r�
s��b�J��J��K�
�
�F�"�6�#3�#3�4�F��
���W�h�'��?�?�$�?���l�"��f�l�l�7�3�4�J�N��
�
�c�1�8M�N�O�F�G����w��/�0�#'����W�(=�#>�K�� �
?��&/�
�&;�	0�"�C�"�'�6���#�#�F�+��&��/�J�s�O�	0�
�{�"�"r4c	�4�i}|D]�}d|vr|jd�\}}n|d}}||vs�%|reg}|jd�D]D}|ddk(r |jt|dd�df��+|jt|���Ft|�}|||<��|S)aQParse keywords specifications from the given list of strings.

    >>> kw = sorted(parse_keywords(['_', 'dgettext:2', 'dngettext:2,3', 'pgettext:1c,2']).items())
    >>> for keyword, indices in kw:
    ...     print((keyword, indices))
    ('_', None)
    ('dgettext', (2,))
    ('dngettext', (2, 3))
    ('pgettext', ((1, 'c'), 2))
    r�Nr����r�)rrxr�r.)�stringsr�r��funcname�indices�inds�xs       r&r�r�Ts����H��)���&�=� &���S� 1��H�g� &��g�H��8�#���� ���s�+�,�A���u��|����S��3�B��[�#�$6�7����C��F�+�	,�
 ��+��!(�H�X��)��Or4�__main__r!)Dr�r�rPrIryr�r(rGr"�collectionsr�configparserrr�iorrrr�rr	�
babel.corer
�babel.messages.catalogrr�babel.messages.extractr
rrr�babel.messages.mofiler�babel.messages.pofilerr�
babel.utilr�	getLoggerr�
setuptoolsr�_CommandrJ�setuptools.errorsrrr�ImportError�	Exception�	distutils�
distutils.cmd�distutils.errorsrrrr0rLr�r�r�rrr5r�r�r�rBr6r4r&�<module>r�sK������	�	�
�
��#�(���(�$�)�:�s�s�*�3���g���� ��
E�.��M�9�H�H�'�T&�h�&�RD#�g�D#�N �W�w�W�t
�"V9�7�V9�rQ�W�Q�hO�O�d0�G#�T��<�z���F���Q"�9�/8�8��8�j�9�9���E�.�1�E�E�E�s0�
D�
D�D�
D�D�D�D1�0D1

Zerion Mini Shell 1.0