Ë
    Æªb†  ã                   ó2  — d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ ddlmZmZmZmZ g d¢Z ej<                  dej>                  «      Z d„ Z! G d„ d«      Z" G d„ de#«      Z$dZ% G d„ 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  — t        j                  d| «      }t        j                  |j	                  d«      d«      }|j	                  d«      }|�d|d   |dd  }}|d d |dd  }}t        |dz   «      }t        |«      }	t        |«      }
|	d	z  }||
z  }||z  }t        |«      }|j                  |¬
«      }|S )Nz+^(?P<datetime>.*?)(?P<tzoffset>[+-]\d{4})?$r   z%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                   ó�   — e Zd ZdZ	 	 dd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zdd„Zed„ «       Zed„ «       Zed„ «       Zy)r   z0Representation of a single message in a catalog.Nc
                 óî  — || _         |s| j                  rd}|| _        t        t	        |«      «      | _        t        |«      | _        |r(| j                  r| j                  j                  d«       n| j                  j                  d«       t        t	        |«      «      | _        t        t	        |«      «      | _        t        |t        «      r	|g| _        nt        |«      | _        || _        |	| _        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
        )Ú r3   zpython-formatN)ÚidÚpluralizableÚstringÚlistr   Ú	locationsÚsetÚflagsÚpython_formatÚaddÚdiscardÚauto_commentsÚuser_commentsÚ
isinstanceÚstrÚprevious_idÚlinenoÚcontext)
Úselfr4   r6   r8   r:   r>   r?   rB   rC   rD   s
             r.   Ú__init__zMessage.__init__J   s¾   € ð$ ˆŒÙ˜$×+Ò+ØˆFØˆŒÜœh yÓ1Ó2ˆŒÜ˜“ZˆŒ
Ù�$×$Ò$Ø�J‰J�N‰N˜?Õ+à�J‰J×Ñ˜Ô/Ü!¤(¨=Ó"9Ó:ˆÔÜ!¤(¨=Ó"9Ó:ˆÔÜ�k¤3Ô'Ø +˜}ˆDÕä# KÓ0ˆDÔØˆŒØˆ�r0   c                 óz   — dt        | «      j                  ›d| j                  ›dt        | j                  «      ›d�S )Nú<ú z	 (flags: z)>)ÚtypeÚ__name__r4   r7   r:   ©rE   s    r.   Ú__repr__zMessage.__repr__o   s+   � Ü(,¨T«
×(;Ó(;¸T¿W»WÜ(,¨T¯Z©ZÕ(8ð:ð 	:r0   c                 ó8   — d„ }t         || «       ||«      «      S )z0Compare Messages, taking into account plural idsc                 ó°   — t        | t        «      r+| j                  r| j                  d   | j                  xs dfS | j                  | j                  xs dfS )Nr   r3   )r@   r   r5   r4   rD   )Úobjs    r.   Úvalues_to_comparez*Message.__cmp__.<locals>.values_to_compareu   sH   € Ü˜#œwÔ'¨C×,<Ò,<Ø—v‘v˜a‘y #§+¡+Ò"3°Ð3Ð3Ø—6‘6˜3Ÿ;™;Ò,¨"Ð,Ð,r0   )r   )rE   ÚotherrQ   s      r.   Ú__cmp__zMessage.__cmp__s   s"   € ò	-ô Ñ% dÓ+Ñ->¸uÓ-EÓFÐFr0   c                 ó*   — | j                  |«      dkD  S ©Nr   ©rS   ©rE   rR   s     r.   Ú__gt__zMessage.__gt__{   ó   € Ø�|‰|˜EÓ" QÑ&Ð&r0   c                 ó*   — | j                  |«      dk  S rU   rV   rW   s     r.   Ú__lt__zMessage.__lt__~   rY   r0   c                 ó*   — | j                  |«      dk\  S rU   rV   rW   s     r.   Ú__ge__zMessage.__ge__�   ó   € Ø�|‰|˜EÓ" aÑ'Ð'r0   c                 ó*   — | j                  |«      dk  S rU   rV   rW   s     r.   Ú__le__zMessage.__le__„   r^   r0   c                 ó*   — | j                  |«      dk(  S rU   rV   rW   s     r.   Ú__eq__zMessage.__eq__‡   r^   r0   c                 ó*   — | j                  |«      dk7  S rU   rV   rW   s     r.   Ú__ne__zMessage.__ne__Š   r^   r0   c                 óX   — t        |t        «      sJ ‚| j                  |j                  k(  S )z[Checks whether messages are identical, taking into account all
        properties.
        )r@   r   Ú__dict__rW   s     r.   Úis_identicalzMessage.is_identical�   s'   € ô ˜%¤Ô)Ð)Ð)Ø�}‰} §¡Ñ.Ð.r0   c                 óô   — t        t        t        | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  f	«      Ž S ©N)r   Úmapr	   r4   r6   r8   r:   r>   r?   rB   rC   rD   rL   s    r.   ÚclonezMessage.clone”   s^   € ÜœœD 4§7¡7¨D¯K©K¸¿¹Ø#'§:¡:¨t×/AÑ/AØ#'×#5Ñ#5°t×7GÑ7GØ#'§;¡;°·±ð#>ó ?ð @ð 	@r0   c                 ó†   — ddl m} g }|D ]  }	  ||| «       Œ |S # t        $ r}|j                  |«       Y d}~Œ0d}~ww xY w)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.checkersrm   r   Úappend)rE   Úcatalogrm   ÚerrorsÚcheckerÚes         r.   ÚcheckzMessage.checkš   sR   € õ 	5ØˆØò 	!ˆGð!Ù˜ Õ&ð	!ð
 ˆøô $ò !Ø—‘˜a× Ñ ûð!ús   �	œ	A ¥;»A c                 ó   — d| j                   v S )a   Whether 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:   rL   s    r.   rv   zMessage.fuzzy­   s   € ð ˜$Ÿ*™*Ð$Ð$r0   c                 óB   — t        | j                  t        t        f«      S )z¯Whether the message is plurizable.

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

        :type:  `bool`)r@   r4   r7   ÚtuplerL   s    r.   r5   zMessage.pluralizable¼   s   € ô ˜$Ÿ'™'¤D¬% =Ó1Ð1r0   c                 óp   — | j                   }t        |t        t        f«      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`c              3   óF   K  — | ]  }t         j                  |«      –— Œ y ­wri   )ÚPYTHON_FORMATÚsearch)Ú.0r4   s     r.   ú	<genexpr>z(Message.python_format.<locals>.<genexpr>Õ   s   è ø€ Ò:°”=×'Ñ'¨×+Ñ:ùs   ‚!)r4   r@   r7   ry   Úany)rE   Úidss     r.   r;   zMessage.python_formatÈ   s3   € ð �g‰gˆÜ˜#¤¤e˜}Ô-Ø�%ˆCÜÑ:°cÔ:Ó:Ð:r0   )r3   © r‚   r‚   r‚   r‚   NNri   )rK   Ú
__module__Ú__qualname__Ú__doc__rF   rM   rS   rX   r[   r]   r`   rb   rd   rg   rk   rt   Úpropertyrv   r5   r;   r‚   r0   r.   r   r   G   s†   „ Ù:àMOØHLó#òJ:òGò'ò'ò(ò(ò(ò(ò/ò@óð& ñ%ó ð%ð ñ	2ó ð	2ð ñ;ó ñ;r0   r   c                   ó   — e Zd ZdZy)r   z_Exception thrown by translation checkers when invalid message
    translations are encountered.N)rK   rƒ   r„   r…   r‚   r0   r.   r   r   Ø   s   „ ò%r0   r   z¸# 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  — e Zd ZdZddeddddddddddfd„Zd„ Zd„ Zd„ Z e	ee«      Z
 e	e«      Zd„ Zd	„ Z e	eed
¬«      Zd„ Zd!d„Zd„ Z e	eed¬«      Ze	d„ «       Ze	d„ «       Ze	d„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	 	 d"d„Zd„ Zd#d„Zd#d„Z d$d„Z!d#d„Z"d „ Z#y)%r   z$Representation of a message catalog.NTc                 óX  — || _         || _        || _        t        «       | _        |xs d| _        |xs d| _        |xs d| _        |xs d| _        |
xs d| _	        	 |xs d| _
        	 |xs d| _        |€t        j                  t        «      }n2t        |t        «      r"|j                   s|j#                  t        ¬	«      }|| _        |	€d
}	n2t        |	t        «      r"|	j                   s|	j#                  t        ¬	«      }	|	| _        || _        t        «       | _        d| _        d| _        y)aD  Initialize 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@ADDRESSzFULL NAME <EMAIL@ADDRESS>zLANGUAGE <LL@li.org>úutf-8Nr   zYEAR-MO-DA HO:MI+ZONE)ÚdomainÚlocaleÚ_header_commentr   Ú	_messagesÚprojectÚversionÚcopyright_holderÚmsgid_bugs_addressÚlast_translatorÚlanguage_teamÚcharsetr   Únowr   r@   r   r#   Úcreation_dateÚrevision_daterv   ÚobsoleteÚ_num_pluralsÚ_plural_expr)rE   r�   rŽ   Úheader_commentr’   r“   r”   r•   rš   r›   r–   r—   r˜   rv   s                 r.   rF   zCatalog.__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Ø*ˆÔØˆŒ
ä#›ˆŒØ ˆÔØ ˆÕr0   c                 ó4  — |€d | _         d | _        y t        |t        «      rt	        |«      | _         || _        y t        |t        «      r,t	        |«      | _         	 t        j
                  |«      | _        y t        d|z  «      ‚# t        $ r
 d | _        Y y w xY w)NzF`locale` must be a Locale, a locale identifier string, or None; got %r)Ú_locale_identifierÚ_localer@   r   rA   Úparser   Ú	TypeError©rE   r�   s     r.   Ú_set_localezCatalog._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ÂBc                 ó   — | j                   S ri   )r¢   rL   s    r.   Ú_get_localezCatalog._get_locale7  s   € Ø�|‰|Ðr0   c                 ó   — | j                   S ri   )r¡   rL   s    r.   Ú_get_locale_identifierzCatalog._get_locale_identifier:  s   € Ø×&Ñ&Ð&r0   c                 ó  — | j                   }t        j                  t        «      j	                  d«      }t        | j                  d«      r| j                  j	                  d«      }|j                  d| j                  «      j                  d| j                  «      j                  d|«      j                  d| j                  «      }| j                  r| j                  j                  n| j                  }|r|j                  dd|z  «      }|S )	Nz%YÚstrftimerŠ   r‹   ÚYEARrŒ   zTranslations templatez%s translations)r�   r   r™   r   r¬   Úhasattrr›   r#   r’   r“   r”   r�   Úenglish_nameÚlocale_identifier)rE   ÚcommentÚyearÚlocale_names       r.   Ú_get_header_commentzCatalog._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Øˆr0   c                 ó   — || _         y ri   )r�   )rE   r6   s     r.   Ú_set_header_commentzCatalog._set_header_commentN  s
   € Ø%ˆÕr0   a…      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 }|j                  d| j                  ›d| j                  ›�f«       |j                  d| j                  f«       |j                  dt	        | j
                  dd¬«      f«       t        | j                  t        t        t        t        f«      r*|j                  dt	        | j                  dd¬«      f«       n|j                  d| j                  f«       |j                  d	| j                  f«       | j                  r&|j                  d
t        | j                  «      f«       | j                  rOd| j                  v rA|j                  d| j                  j!                  dt        | j                  «      «      f«       n|j                  d| j                  f«       | j"                  �|j                  d| j$                  f«       |j                  d«       |j                  dd| j&                  z  f«       |j                  d«       |j                  ddt(        z  f«       |S )NzProject-Id-VersionrI   zReport-Msgid-Bugs-TozPOT-Creation-Datezyyyy-MM-dd HH:mmZÚen)r�   zPO-Revision-DatezLast-TranslatorÚLanguageÚLANGUAGEzLanguage-TeamzPlural-Forms)zMIME-Versionz1.0zContent-Typeztext/plain; charset=%s)zContent-Transfer-EncodingÚ8bitzGenerated-Byz	Babel %s
)ro   r’   r“   r•   r   rš   r@   r›   r   Útime_r"   Úfloatr–   r°   rA   r—   r#   r�   Úplural_formsr˜   r‹   )rE   Úheaderss     r.   Ú_get_mime_headerszCatalog._get_mime_headersr  sí  € ØˆØ�‰Ð,Ø#'§<£<°·²Ð>ð@ô 	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Ñ(>Ð?Ô@Øˆr0   c                 ó€   — t        |t        «      r|S t        |t        «      r|j                  ||«      S t        |«      S ri   )r@   rA   ÚbytesÚdecode)rE   ÚsÚencodingrq   s       r.   Ú_force_textzCatalog._force_text’  s5   € Ü�aœÔØˆHÜ�aœÔØ—8‘8˜H fÓ-Ð-Ü�1‹vˆr0   c                 ó*  — |D �]�  \  }}| j                  |j                  «       | j                  ¬«      }| j                  || j                  ¬«      }|dk(  r5|j                  d«      }dj	                  |d d «      | _        |d   | _        Œ‰|dk(  r|| _        Œ–|dk(  r|| _        Œ£|dk(  r$|j                  dd	«      }| j                  |«       ŒÌ|d
k(  r|| _        ŒÙ|dk(  r-t        |«      \  }}d|v sŒñ|d   j                  «       | _        �Œ|dk(  rJt        d|z   «      \  }}t        |j                  dd«      «      | _        |j                  dd«      | _        �ŒZ|dk(  rt#        |«      | _        �Œq|dk(  s�Œxd|vs�Œ~t#        |«      | _        �Œ� y )N)rÆ   zproject-id-versionrI   éÿÿÿÿzreport-msgid-bugs-tozlast-translatorÚlanguageú-Ú_zlanguage-teamzcontent-typer˜   zplural-formsz ;Únpluralsr   Úpluralú(n != 1)zpot-creation-datezpo-revision-dater­   )rÇ   Úlowerr˜   ÚsplitÚjoinr’   r“   r•   r–   r#   r¦   r—   r   r"   Úgetr�   rž   r/   rš   r›   )rE   rÀ   Únamer$   ÚpartsÚmimetypeÚparamsrÌ   s           r.   Ú_set_mime_headerszCatalog._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Ö&ñ;	Gr0   aÄ      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}| j                  rt        | j                  «      d   }|| _         | j                   S )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`r   r   )r�   r�   r   )rE   Únums     r.   Únum_pluralszCatalog.num_pluralsì  sC   € ð ×ÑÐ$ØˆCØ�{Š{Ü  §¡Ó-¨aÑ0�Ø #ˆDÔØ× Ñ Ð r0   c                 óŒ   — | j                   €-d}| j                  rt        | j                  «      d   }|| _         | j                   S )aW  The 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_exprzCatalog.plural_exprý  sC   € ð ×ÑÐ$ØˆDØ�{Š{Ü! $§+¡+Ó.¨qÑ1�Ø $ˆDÔØ× Ñ Ð r0   c                 ó<   — 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Þ   rL   s    r.   r¿   zCatalog.plural_forms  s   � ð -1×,<Ó,<¸d×>NÓ>NÐOÐOr0   c                 ó<   — | j                  |«      | j                  v S )z?Return whether the catalog has a message with the specified ID.©Ú_key_forr‘   ©rE   r4   s     r.   Ú__contains__zCatalog.__contains__  s   € à�}‰}˜RÓ  D§N¡NÐ2Ð2r0   c                 ó,   — t        | j                  «      S )zeThe number of messages in the catalog.

        This does not include the special ``msgid ""`` entry.)Úlenr‘   rL   s    r.   Ú__len__zCatalog.__len__   s   € ô �4—>‘>Ó"Ð"r0   c              #   ó  K  — g }| j                   D ]  \  }}|j                  |›d|›�«       Œ t        «       }| j                  r|dhz  }t	        ddj                  |«      |¬«      –— | 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: rv   r3   ú
rw   N)Úmime_headersro   r9   rv   r   rÒ   r‘   )rE   ÚbufrÔ   r$   r:   Úkeys         r.   Ú__iter__zCatalog.__iter__&  sŠ   è ø€ ð
 ˆØ×,Ñ,ò 	1‰KˆD�%Ø�J‰J¢4©Ð/Õ0ð	1ä“ˆØ�:Š:Ø�g�YÑˆEÜ�c˜4Ÿ9™9 S›>°Ô7Ò7Ø—>‘>ò 	&ˆCØ—.‘. Ñ%Ó%ñ	&ùs   ‚BBc                 óŒ   — d}| j                   rd| j                   z  }dt        | «      j                  ›d| j                  ›|›d�S )Nr3   z %srH   rI   ú>)r�   rJ   rK   rŽ   r¥   s     r.   rM   zCatalog.__repr__5  s8   € ØˆØ�;Š;Ø˜TŸ[™[Ñ(ˆFøÜ" 4›j×1Ó1°4·;²;ÂÐGÐGr0   c                 ó&   — | j                  |«       y)z)Delete the message with the specified ID.N)Údeleterä   s     r.   Ú__delitem__zCatalog.__delitem__;  s   € à�‰�B�r0   c                 ó$   — | j                  |«      S )zUReturn the message with the specified ID.

        :param id: the message ID
        )rÓ   rä   s     r.   Ú__getitem__zCatalog.__getitem__?  s   € ð
 �x‰x˜‹|Ðr0   c                 óF  — t        |t        «      sJ d«       ‚| j                  ||j                  «      }| j                  j                  |«      }|rì|j                  r.|j                  s"|j                  |_        |j                  |_        t        t        |j                  |j                  z   «      «      |_        t        t        |j                  |j                  z   «      «      |_        t        t        |j                  |j                  z   «      «      |_        |xj                  |j                  z  c_        |}y|dk(  ryt        |j                  «      j!                  «       | _        dj%                  |j                  D �cg c]  }d|z  j'                  «       ‘Œ c}«      | _        |j*                  | _        yt        |t        t,        f«      r=t        |j                  t        t,        f«      sJ dt/        |j                  «      z  «       ‚|| j                  |<   yc c}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
        zexpected a Message objectr3   rê   z# %szExpected sequence but got %sN)r@   r   rã   rD   r‘   rÓ   r5   r4   r6   r7   r   r8   r>   r?   r:   r   Úitemsrë   rÒ   ÚrstriprŸ   rv   ry   rJ   )rE   r4   Úmessagerí   ÚcurrentÚcs         r.   Ú__setitem__zCatalog.__setitem__F  sÃ  € ô, ˜'¤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Òùò-Gs   ÆHc
                 óJ   — t        ||t        |«      ||||||	¬«	      }
|
| |<   |
S )at  Add 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
        )rC   rD   )r   r7   )rE   r4   r6   r8   r:   r>   r?   rB   rC   rD   rù   s              r.   r<   zCatalog.addx  s6   € ô6 ˜"˜f¤d¨9£o°u¸mØ'¨¸VØ")ô+ˆð ˆˆR‰Øˆr0   c              #   ó€   K  — | j                   j                  «       D ]  }|j                  | ¬«      }|sŒ||f–— Œ y­w)aB  Run 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``
        )rp   N)r‘   Úvaluesrt   )rE   rù   rq   s      r.   rt   zCatalog.check™  sA   è ø€ ð —~‘~×,Ñ,Ó.ò 	&ˆGØ—]‘]¨4�]Ó0ˆFÚØ˜v�oÓ%ñ	&ùs   ‚2>µ	>c                 óX   — | j                   j                  | 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ã   )rE   r4   rD   s      r.   rÓ   zCatalog.get§  s$   € ð �~‰~×!Ñ! $§-¡-°°GÓ"<Ó=Ð=r0   c                 ó`   — | j                  ||«      }|| j                  v r| j                  |= yy)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â   ©rE   r4   rD   rí   s       r.   rò   zCatalog.delete¯  s1   € ð �m‰m˜B Ó(ˆØ�$—.‘.Ñ Ø—‘˜sÑ#ð !r0   c                 ó*  ‡ ‡‡‡‡— ‰ j                   Š‰j                  «       Št        «       ‰ _         g }|s=‰D �ci c]2  }|r.‰|   j                  r‰ j	                  |«      ‰|   j
                  “Œ4 }}t        «       Šˆˆˆˆˆ fd„}|D ]Á  }|j                  sŒ‰ j	                  |j                  |j
                  «      }	|	‰v r |||	|	«       ŒE|slt        |	t        «      r|	d   }
n|	}
t        |
j                  «       j                  «       |j                  «       d«      }|r|d   }||   }|�||f} ||||	«       Œ³|‰ |j                  <   ŒÃ ‰D ]  }|s|‰vsŒ
‰|   ‰ j                  |<   Œ |r|j                  ‰ _        |j                   ‰ _        yc c}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}||k7  rld}‰j                  |«       ‰j                  |«      }t        |j                  t
        «      r|j                  g| _        n-t        |j                  «      | _        n‰j                  |d «      }|j                  | _	        ‰r#t        t        |j                  «      «      | _        t        | j                  t        t        f«      r°t        | j                  t        t        f«      s;d}t        | j                  gdgt        | j                  «      dz
  z  z   «      | _	        n‹t        | j                  «      ‰	j                  k7  rid}t        | j                  d t        |j                  «       «      | _	        n6t        | j                  t        t        f«      rd}| j                  d   | _	        | xj                  |j                  z  c_        |r| xj                  dhz  c_        | ‰	| j                  <   y )NFTr3   r   r   rv   )rk   r<   rÓ   r@   r4   rA   rB   r7   Úpopr6   r   r?   ry   rç   rÛ   r:   )
rù   ÚoldkeyÚnewkeyrv   ÚoldmsgÚfuzzy_matchesÚkeep_user_commentsÚmessagesÚ	remainingrE   s
        €€€€€r.   Ú_mergezCatalog.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�—‘Òr0   r   r   N)r‘   r	   r   r6   rã   rD   r9   r4   r@   ry   r   rÐ   ÚstripÚkeysrœ   rŸ   rš   )rE   ÚtemplateÚno_fuzzy_matchingÚupdate_header_commentr
  Úfuzzy_candidatesÚmsgidr  rù   rí   ÚmatchkeyÚmatchesr  Únewctxtr	  r  r  s   `   `         @@@r.   ÚupdatezCatalog.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   ¹7Fc                 óL   — |}t        |t        t        f«      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@   r7   ry   r  s       r.   rã   zCatalog._key_forC  s4   € ð
 ˆÜ�cœD¤%˜=Ô)Ø�Q‘%ˆCØÐØ˜�.ˆCØˆ
r0   c                 ób  — t        |t        «      sJ ‚| j                  j                  «       |j                  j                  «       z  D ];  }| j	                  |«      }|j	                  |«      }|�|�|j                  |«      rŒ; y t        | j                  «      t        |j                  «      k(  S )z\Checks if catalogs are identical, taking into account messages and
        headers.
        F)r@   r   r‘   r  rÓ   rg   Údictrë   )rE   rR   rí   Ú	message_1Ú	message_2s        r.   rg   zCatalog.is_identicalO  sœ   € ô ˜%¤Ô)Ð)Ð)Ø—>‘>×&Ñ&Ó(¨5¯?©?×+?Ñ+?Ó+AÑAò 	ˆCØŸ™ ›ˆIØŸ	™	 #›ˆIàÐ!ØÐ$Ø ×-Ñ-¨iÕ8áð	ô �D×%Ñ%Ó&¬$¨u×/AÑ/AÓ*BÑBÐBr0   )r�   Ústrict)Nr‚   r‚   r‚   r‚   r‚   NNri   )FFT)$rK   rƒ   r„   r…   ÚDEFAULT_HEADERrF   r¦   r¨   rª   r†   r�   r°   r´   r¶   rŸ   rÁ   rÇ   rØ   rë   rÛ   rÞ   r¿   rå   rè   rî   rM   ró   rõ   rü   r<   rt   rÓ   rò   r  rã   rg   r‚   r0   r.   r   r   å   s6  „ Ù.à"¨4ÀØ t¸dØ$(¸Ø#°TÈØ Tó	8!òtkò*ò'ñ �k ;Ó/€FÙ Ð!7Ó8Ðòò&ñ Ð1Ð3Fð Mô 	€NòBó@òGñ@ Ð-Ð/@ð 1Gô 1	€Lðf ñ!ó ð!ð  ñ!ó ð!ð$ ñ	Pó ð	Pò3ò#ò&òHòòò0*ðd JLØCGóòB&ó>ó$óH4óT
óCr0   r   )'r…   r   Úcgir   Úcollectionsr   r   r   r½   Údifflibr   Úemailr   r	   Úbabelr
   r‹   Ú
babel.corer   r   Úbabel.datesr   Úbabel.messages.pluralsr   Ú
babel.utilr   r   r   r   Ú__all__ÚcompileÚVERBOSEr|   r/   r   Ú	Exceptionr   r  r   r‚   r0   r.   ú<module>r-     s‹   ðñó 
å Ý #ß ,Ý %Ý %Ý å (ß 1Ý 'Ý -ß CÓ Câ
4€ð �—
‘
ð 	ð ‡Z�Zó	€ò÷<N;ñ N;ôb%�yô %ð
€÷x	Cò x	Cr0   