%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__/catalog.cpython-312.pyc

�

ƪb���2�dZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
m
Z
dd	lmZdd
lmZmZddlmZddlmZdd
lmZmZmZmZgd�Zej<dej>�Z d�Z!Gd�d�Z"Gd�de#�Z$dZ%Gd�d�Z&y)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�j�tjd|�}tj|j	d�d�}|j	d�}|�d|d|dd}}|dd|dd}}t|dz�}t|�}	t|�}
|	d	z}||
z
}||z}t
|�}|j|�
�}|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�H�C�U�K�E�	�	�	�5�;�;�z�2�4D�	E�B��{�{�:�&�H���%�a�[�(�1�2�,�d��(,�R�a��$�q�r�(�
�����+�,�
��>�*���-�(��'��+���;�&���:�%��'��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��Zy)rz0Representation of a single message in a catalog.Nc
���||_|s|jrd}||_tt	|��|_t
|�|_|r(|jr|jjd�n|jjd�tt	|��|_tt	|��|_t|t�r	|g|_nt|�|_||_|	|_y)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
        )�r3z
python-formatN)�id�pluralizable�string�listr�	locations�set�flags�
python_format�add�discard�
auto_comments�
user_comments�
isinstance�str�previous_id�lineno�context)
�selfr4r6r8r:r>r?rBrCrDs
          r.�__init__zMessage.__init__Js���$����$�+�+��F�����h�y�1�2�����Z��
�
�$�$�$��J�J�N�N�?�+��J�J����/�!�(�=�"9�:���!�(�=�"9�:����k�3�'� +�}�D��#�K�0�D�������r0c�z�dt|�j�d|j�dt|j��d�S)N�<� z	 (flags: z)>)�type�__name__r4r7r:�rEs r.�__repr__zMessage.__repr__os+��(,�T�
�(;�(;�T�W�W�(,�T�Z�Z�(8�:�	:r0c�8�d�}t||�||��S)z0Compare Messages, taking into account plural idsc��t|t�r+|jr|jd|jxsdfS|j|jxsdfS)Nrr3)r@rr5r4rD)�objs r.�values_to_comparez*Message.__cmp__.<locals>.values_to_compareusH���#�w�'�C�,<�,<��v�v�a�y�#�+�+�"3��3�3��6�6�3�;�;�,�"�,�,r0)r)rE�otherrQs   r.�__cmp__zMessage.__cmp__ss"��	-��%�d�+�->�u�-E�F�Fr0c�*�|j|�dkDS�Nr�rS�rErRs  r.�__gt__zMessage.__gt__{����|�|�E�"�Q�&�&r0c�*�|j|�dkSrUrVrWs  r.�__lt__zMessage.__lt__~rYr0c�*�|j|�dk\SrUrVrWs  r.�__ge__zMessage.__ge__�����|�|�E�"�a�'�'r0c�*�|j|�dkSrUrVrWs  r.�__le__zMessage.__le__�r^r0c�*�|j|�dk(SrUrVrWs  r.�__eq__zMessage.__eq__�r^r0c�*�|j|�dk7SrUrVrWs  r.�__ne__zMessage.__ne__�r^r0c�X�t|t�sJ�|j|jk(S)z[Checks whether messages are identical, taking into account all
        properties.
        )r@r�__dict__rWs  r.�is_identicalzMessage.is_identical�s'���%��)�)�)��}�}����.�.r0c���ttt|j|j|j
|j|j|j|j|j|jf	��S�N)r�mapr	r4r6r8r:r>r?rBrCrDrLs r.�clonez
Message.clone�s^����D�4�7�7�D�K�K����#'�:�:�t�/A�/A�#'�#5�#5�t�7G�7G�#'�;�;����#>�?�@�	@r0c��ddlm}g}|D]}	|||��|S#t$r}|j|�Yd}~�0d}~wwxYw)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.checkersrmr�append)rE�catalogrm�errors�checker�es      r.�checkz
Message.check�sR��	5����	!�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:rLs r.rvz
Message.fuzzy�s���$�*�*�$�$r0c�B�t|jttf�S)z�Whether the message is plurizable.

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

        :type:  `bool`)r@r4r7�tuplerLs r.r5zMessage.pluralizable�s���$�'�'�D�%�=�1�1r0c�p�|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�FK�|]}tj|����y�wri)�
PYTHON_FORMAT�search)�.0r4s  r.�	<genexpr>z(Message.python_format.<locals>.<genexpr>�s����:��=�'�'��+�:�s�!)r4r@r7ry�any)rE�idss  r.r;zMessage.python_format�s3���g�g���#��e�}�-��%�C��:�c�:�:�:r0)r3�r�r�r�r�NNri)rK�
__module__�__qualname__�__doc__rFrMrSrXr[r]r`rbrdrgrkrt�propertyrvr5r;r�r0r.rrGs���:�MO�HL�#�J:�G�'�'�(�(�(�(�/�@��&�%��%��	2��	2��;��;r0rc��eZdZdZy)rz_Exception thrown by translation checkers when invalid message
    translations are encountered.N)rKr�r�r�r�r0r.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
�D�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#y)%rz$Representation of a message catalog.NTc�X�||_||_||_t�|_|xsd|_|xsd|_|xsd|_|xsd|_|
xsd|_		|xsd|_
	|xsd|_|�tjt�}n2t|t�r"|j s|j#t�	�}||_|	�d
}	n2t|	t�r"|	j s|	j#t�	�}	|	|_|
|_t�|_d|_d|_y)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�nowrr@rr#�
creation_date�
revision_daterv�obsolete�_num_plurals�_plural_expr)rEr�r��header_commentr�r�r�r�r�r�r�r�r�rvs              r.rFzCatalog.__init__�s��2������-���$�����+�)����+�)��� 0� B�N���"4�"G����.�M�2M���<�*�D�.D���:��)�'���� �$�L�L��1�M�
�
�x�
0��9M�9M�)�1�1��1�A�M�*���� �3�M�
�
�x�
0��9M�9M�)�1�1��1�A�M�*�����
�#�
��
� ��� ��r0c�4�|�d|_d|_yt|t�rt	|�|_||_yt|t�r,t	|�|_	tj
|�|_ytd|z��#t$r
d|_YywxYw)NzF`locale` must be a Locale, a locale identifier string, or None; got %r)�_locale_identifier�_localer@rrA�parser�	TypeError�rEr�s  r.�_set_localezCatalog._set_locale"s����>�&*�D�#��D�L���f�f�%�&)�&�k�D�#�!�D�L���f�c�"�&)�&�k�D�#�
$�%�|�|�F�3���
��`�ci�i�j�j��	&�
$�#����
$�s�B�B�Bc��|jSri)r�rLs r.�_get_localezCatalog._get_locale7s���|�|�r0c��|jSri)r�rLs r.�_get_locale_identifierzCatalog._get_locale_identifier:s���&�&�&r0c��|j}tjt�j	d�}t|jd�r|jj	d�}|jd|j�jd|j�jd|�jd|j�}|jr|jjn|j}|r|jdd|z�}|S)	Nz%Y�strftimer�r��YEARr�zTranslations templatez%s translations)r�rr�rr��hasattrr�r#r�r�r�r��english_name�locale_identifier)rE�comment�year�locale_names    r.�_get_header_commentzCatalog._get_header_comment@s����&�&���|�|�G�$�-�-�d�3���4�%�%�z�2��%�%�.�.�t�4�D��/�/�)�T�\�\�:�!�'�)�T�\�\�:�!�'�&�$�/�!�'�.�$�2G�2G�H�	�48�;�;�t�{�{�/�/�D�DZ�DZ����o�o�&=�?P�S^�?^�_�G��r0c��||_yri)r�)rEr6s  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	�h�g}|jd|j�d|j��f�|jd|jf�|jdt	|j
dd��f�t
|jttttf�r*|jdt	|jdd��f�n|jd|jf�|jd	|jf�|jr&|jd
t|j�f�|jrOd|jvrA|jd|jj!dt|j��f�n|jd|jf�|j"�|jd
|j$f�|jd�|jdd|j&zf�|jd�|jddt(zf�|S)NzProject-Id-VersionrIzReport-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
)ror�r�r�r
r�r@r�r�time_r"�floatr�r�rAr�r#r��plural_formsr�r�)rE�headerss  r.�_get_mime_headerszCatalog._get_mime_headersrs��������,�#'�<�<����>�@�	A����.��0G�0G�H�I����+�'��(:�(:�<O�/3�5�6�	7��d�(�(�8�U�C��*G�H��N�N�.�+�D�,>�,>�,?��N�O�
P�
�N�N�.��0B�0B�C�D����)�4�+?�+?�@�A��!�!��N�N�J��D�,B�,B�(C�D�E��!�!�z�T�5G�5G�'G��N�N�O� �.�.�6�6�z�7:�4�;Q�;Q�7R�T�U�
V�
�N�N�O�T�-?�-?�@�A��;�;�"��N�N�N�D�,=�,=�>�?����.�/�����0�4�<�<�?�A�	B����<�=������w�(>�?�@��r0c��t|t�r|St|t�r|j||�St|�Sri)r@rA�bytes�decode)rE�s�encodingrqs    r.�_force_textzCatalog._force_text�s5���a����H��a����8�8�H�f�-�-��1�v�
r0c�*�|D�]�\}}|j|j�|j��}|j||j��}|dk(r5|jd�}dj	|dd�|_|d|_��|dk(r||_��|dk(r||_��|dk(r$|jdd	�}|j|���|d
k(r||_��|dk(r-t|�\}}d|vs��|dj�|_��|d
k(rJtd|z�\}}t|jdd��|_|jdd�|_��Z|dk(rt#|�|_��q|dk(s��xd|vs��~t#|�|_���y)N)r�zproject-id-versionrI���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�)rEr��namer$�parts�mimetype�paramsr�s        r.�_set_mime_headerszCatalog._set_mime_headers�s���"�	G�K�D�%��#�#�D�J�J�L�4�<�<�#�H�D��$�$�U�T�\�\�$�B�E��+�+����C�(��#�y�y��s���4���$�R�y����/�/�*/��'��*�*�',��$���#��
�
�c�3�/��� � ��'���(�%*��"���'�#/��#6� ��&���&�#)�)�#4�#:�#:�#<�D�L���'�(����6�	��6�$'��
�
�:�q�(A�$B��!�$*�J�J�x��$D��!��,�,�%;�E�%B��"��+�+���&�)?��)F�D�&�;	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��|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`rr)r�r�r)rE�nums  r.�num_pluralszCatalog.num_plurals�sC�����$��C��{�{� ����-�a�0�� #�D��� � � r0c��|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`r�r)r�r�r)rE�exprs  r.�plural_exprzCatalog.plural_expr�sC�����$��D��{�{�!�$�+�+�.�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�rLs r.r�zCatalog.plural_formss��-1�,<�,<�d�>N�>N�O�Or0c�<�|j|�|jvS)z?Return whether the catalog has a message with the specified ID.��_key_forr��rEr4s  r.�__contains__zCatalog.__contains__s���}�}�R� �D�N�N�2�2r0c�,�t|j�S)zeThe number of messages in the catalog.

        This does not include the special ``msgid ""`` entry.)�lenr�rLs r.�__len__zCatalog.__len__ s���4�>�>�"�"r0c#�K�g}|jD]\}}|j|�d|����t�}|jr|dhz}t	ddj|�|����|jD]}|j|���y�w)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: rvr3�
rwN)�mime_headersror9rvrr�r�)rE�bufr�r$r:�keys      r.�__iter__zCatalog.__iter__&s�����
���,�,�	1�K�D�%��J�J�4��/�0�	1�����:�:��g�Y��E��c�4�9�9�S�>��7�7��>�>�	&�C��.�.��%�%�	&�s�BB
c��d}|jrd|jz}dt|�j�d|j�|�d�S)Nr3z %srHrI�>)r�rJrKr�r�s  r.rMzCatalog.__repr__5s8�����;�;��T�[�[�(�F��"�4�j�1�1�4�;�;��G�Gr0c�&�|j|�y)z)Delete the message with the specified ID.N)�deleter�s  r.�__delitem__zCatalog.__delitem__;s
�����B�r0c�$�|j|�S)zUReturn the message with the specified ID.

        :param id: the message ID
        )r�r�s  r.�__getitem__zCatalog.__getitem__?s��
�x�x��|�r0c�F�t|t�sJd��|j||j�}|jj|�}|r�|jr.|js"|j|_|j|_tt|j|jz��|_tt|j|jz��|_tt|j|jz��|_
|xj|jzc_|}y|dk(ryt|j�j!�|_dj%|jD�cgc]}d|zj'���c}�|_|j*|_yt|tt,f�r=t|jtt,f�sJdt/|j�z��||j|<ycc}w)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 objectr3r�z# %szExpected sequence but got %sN)r@rr�rDr�r�r5r4r6r7rr8r>r?r:r�itemsr�r��rstripr�rvryrJ)rEr4�messager��current�cs      r.�__setitem__zCatalog.__setitem__Fs���,�'�7�+�H�-H�H�+��m�m�B����0���.�.�$�$�S�)����#�#�G�,@�,@�$�Z�Z��
�!(����� $�X�g�.?�.?�.5�.?�.?�/@�&A�!B�G��$(��'�2G�2G�29�2G�2G�3H�*I�%J�G�!�$(��'�2G�2G�29�2G�2G�3H�*I�%J�G�!��M�M�W�]�]�*�M��G�
�2�X� 3�G�N�N� C� I� I� K�D��"&�)�)�07�0E�0E�-G�q�f�q�j�-@�-@�-B�-G�#H�D�� ���D�J��"�t�U�m�,�!�'�.�.�4��-�@�J�2�T�'�.�.�5I�I�J�@�")�D�N�N�3���-Gs�Hc
�J�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
        )rCrD)rr7)rEr4r6r8r:r>r?rBrCrDr�s           r.r<zCatalog.addxs6��6�"�f�d�9�o�u�m�'��V�")�+����R���r0c#�K�|jj�D]}|j|��}|s�||f���y�w)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``
        )rpN)r��valuesrt)rEr�rqs   r.rtz
Catalog.check�sA�����~�~�,�,�.�	&�G��]�]�4�]�0�F���v�o�%�	&�s�2>�	>c�X�|jj|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�)rEr4rDs   r.r�zCatalog.get�s$���~�~�!�!�$�-�-��G�"<�=�=r0c�`�|j||�}||jvr|j|=yy)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��rEr4rDr�s    r.r�zCatalog.delete�s1���m�m�B��(���$�.�.� ����s�#�!r0c�*�������j��j��t��_g}|s=�D�cic]2}|r.�|jr�j	|��|j
��4}}t
�������fd�}|D]�}|js��j	|j|j
�}	|	�vr|||	|	��E|slt|	t�r|	d}
n|	}
t|
j�j�|j�d�}|r|d}||}
|
�||
f}||||	���|�|j<���D]}|s|�vs�
�|�j|<�|r|j�_|j �_ycc}w)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�4��|j�}d}||k7rld}�j|��j|�}t|jt
�r|jg|_n-t|j�|_n�j|d�}|j|_	�r#tt|j��|_t|jttf�r�t|jttf�s;d}t|jgdgt|j�dz
zz�|_	n�t|j��	jk7rid}t|jdt|j��|_	n6t|jttf�rd}|jd|_	|xj|jzc_|r|xjdhzc_|�	|j<y)NFTr3rrrv)rkr<r�r@r4rArBr7�popr6rr?ryr�r�r:)
r��oldkey�newkeyrv�oldmsg�
fuzzy_matches�keep_user_comments�messages�	remainingrEs
     �����r.�_mergezCatalog.update.<locals>._merge�s�����m�m�o�G��E�������!�!�&�)�!���f�-���f�i�i��-�+1�9�9�+�G�'�*.�v�y�y�/�G�'�"���v�t�4��#�]�]�G�N�!�(,�X�f�6J�6J�-K�(L��%��'�*�*�t�U�m�4�!�'�.�.�4��-�@� �E�%*� ���(�S�E�S����_�q�5H�,I�J�&�G�N�����(�D�,<�,<�<� �E�%*�7�>�>�:M�3�v�}�}�;M�+N�%O�G�N��G�N�N�T�5�M�:���!(����!2����M�M�V�\�\�)�M���
�
�(��+�
�&�D����r0rrN)r�r	rr6r�rDr9r4r@ryrr��strip�keysr�r�r�)rE�template�no_fuzzy_matching�update_header_commentr
�fuzzy_candidates�msgidr
r�r��matchkey�matchesr�newctxtr	rrs`   `         @@@r.�updatezCatalog.update�s����j�>�>���M�M�O�	�$������ �&� ���8�E�?�3I�3I��
�
�e�$�h�u�o�&=�&=�=� �� ���
�!	'�!	'�F �	/�G��z�z��m�m�G�J�J����@���(�?��7�C��-�,�%�c�5�1�'*�1�v�H�'*�H�"3�H�N�N�4D�4J�4J�4L�4D�4I�4I�4K�Q�#P��"�%,�Q�Z�F�&6�v�&>�G�&�2�)/����"�7�F�C�8�$�'.�D����$�-	/�0�	8�E� �E��$>�'0��'7��
�
�e�$�	8�!�#+�"9�"9�D��&�3�3����Y s�7Fc�L�|}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)r@r7ryrs    r.r�zCatalog._key_forCs4��
���c�D�%�=�)��Q�%�C�����.�C��
r0c�b�t|t�sJ�|jj�|jj�zD];}|j	|�}|j	|�}|�|�|j|�r�;yt
|j�t
|j�k(S)z\Checks if catalogs are identical, taking into account messages and
        headers.
        F)r@rr�rr�rg�dictr�)rErRr��	message_1�	message_2s     r.rgzCatalog.is_identicalOs����%��)�)�)��>�>�&�&�(�5�?�?�+?�+?�+A�A�	�C�����
�I��	�	�#��I��!��$� �-�-�i�8��	��D�%�%�&�$�u�/A�/A�*B�B�Br0)r��strict)Nr�r�r�r�r�NNri)FFT)$rKr�r�r��DEFAULT_HEADERrFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rMr�r�r�r<rtr�r�rr�rgr�r0r.rr�s6��.�"�4���t�d�$(��#�T���T�	8!�tk�*�'��k�;�
/�F� �!7�8���&��1�3F�M�	�N�B�@�G�@�-�/@�1G�1	�L�f�!��!� �!��!�$�	P��	P�3�#�
&�H���0*�dJL�CG��B&�>�$�H4�T
�Cr0r)'r�r�cgir�collectionsrrrr��difflibr�emailrr	�babelr
r��
babel.corerr�babel.datesr
�babel.messages.pluralsr�
babel.utilrrrr�__all__�compile�VERBOSEr|r/r�	Exceptionrrrr�r0r.�<module>r-s����
��#�,�%�%��(�1�'�-�C�C�
4����
�
�	��Z�Z�	�
��<N;�N;�b%�y�%�
��x	C�x	Cr0

Zerion Mini Shell 1.0