§
    Æªbu  ã                   ó\   — d Z ddlmZmZ h d£ddhh d£gZd„ Zd„ Zd	„ Zd
„ Z e¦   «         Z	dS )zö
    babel.messages.checkers
    ~~~~~~~~~~~~~~~~~~~~~~~

    Various routines that help with validation of translations.

    :since: version 0.9

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
é    )ÚTranslationErrorÚPYTHON_FORMAT>   ÚdÚiÚuÚxÚX>   ÚFÚGÚfÚgc                 ó  — |j         s+t          |j        t          ¦  «        st	          d¦  «        ‚dS | €dS |j        }t          |t
          t          f¦  «        s|f}t          |¦  «        | j        k    rt	          d| j        z  ¦  «        ‚dS )z0Verify the number of plurals in the translation.z/Found plural forms for non-pluralizable messageNz*Wrong number of plural forms (expected %d))	ÚpluralizableÚ
isinstanceÚstringÚstrr   ÚlistÚtupleÚlenÚnum_plurals)ÚcatalogÚmessageÚmsgstrss      ú9/usr/lib/python3/dist-packages/babel/messages/checkers.pyr   r      s©   € àÔð Ý˜'œ.­#Ñ.Ô.ð 	.Ý"ð $-ñ .ô .ð .àˆð 
ˆØˆàŒn€GÝ�g¥¥e˜}Ñ-Ô-ð Ø�*ˆÝ
ˆ7�|„|�wÔ*Ò*Ð*ÝÐKØ&Ô2ñ 3ñ 4ô 4ð 	4ð +Ð*ó    c                 ó  — d|j         vrdS |j        }t          |t          t          f¦  «        s|f}|j        }t          |t          t          f¦  «        s|f}t          ||¦  «        D ]\  }}|rt          ||¦  «         ŒdS )z9Verify the format string placeholders in the translation.zpython-formatN)ÚflagsÚidr   r   r   r   ÚzipÚ_validate_format)r   r   Úmsgidsr   ÚmsgidÚmsgstrs         r   Úpython_formatr$   ,   sœ   € à˜gœmÐ+Ð+ØˆØŒZ€FÝ�f�t¥U˜mÑ,Ô,ð Ø�ˆØŒn€GÝ�g¥¥e˜}Ñ-Ô-ð Ø�*ˆå˜V WÑ-Ô-ð ,ð ,‰ˆˆvØð 	,Ý˜U FÑ+Ô+Ð+øð,ð ,r   c           
      ó‚  — d„ }d„ }d„ }t          || |f¦  «        \  }}t          |||f¦  «        \  }}|r|s|st          d¦  «        ‚||k    rt          d¦  «        ‚|r�t          |¦  «        t          |¦  «        k    rt          d¦  «        ‚t          t	          ||¦  «        ¦  «        D ]2\  }	\  \  }
}\  }
} |||¦  «        st          d|	dz   ||fz  ¦  «        ‚Œ3dS t          |¦  «        }|D ]L\  }}||vrt          d	|z  ¦  «        ‚ ||||         ¦  «        st          d
|›d|›d||         ›d�¦  «        ‚ŒMdS )a‹  Test format string `alternative` against `format`.  `format` can be the
    msgid of a message and `alternative` one of the `msgstr`\s.  The two
    arguments are not interchangeable as `alternative` may contain less
    placeholders if `format` uses named placeholders.

    The behavior of this function is undefined if the string does not use
    string formattings.

    If the string formatting of `alternative` is compatible to `format` the
    function returns `None`, otherwise a `TranslationError` is raised.

    Examples for compatible format strings:

    >>> _validate_format('Hello %s!', 'Hallo %s!')
    >>> _validate_format('Hello %i!', 'Hallo %d!')

    Example for an incompatible format strings:

    >>> _validate_format('Hello %(name)s!', 'Hallo %s!')
    Traceback (most recent call last):
      ...
    TranslationError: the format strings are of different kinds

    This function is used by the `python_format` checker.

    :param format: The original format string
    :param alternative: The alternative format string that should be checked
                        against format
    :raises TranslationError: on formatting errors
    c                 óÂ   — g }t          j        | ¦  «        D ]G}|                     ¦   «         \  }}}|dk    r|€Œ#|                     |t	          |¦  «        f¦  «         ŒH|S )Nú%)r   ÚfinditerÚgroupsÚappendr   )r   ÚresultÚmatchÚnameÚformatÚtypechars         r   Ú_parsez _validate_format.<locals>._parse\   sj   € ØˆÝ"Ô+¨FÑ3Ô3ð 	1ð 	1ˆEØ%*§\¢\¡^¤^Ñ"ˆD�&˜(Ø˜3Šˆ 4 <ØØ�MŠM˜4¥ X¡¤Ð/Ñ0Ô0Ð0Ð0Øˆr   c                 ó@   — | |k    rdS t           D ]}| |v r||v r dS ŒdS )NTF)Ú_string_format_compatibilities)ÚaÚbÚsets      r   Ú_compatiblez%_validate_format.<locals>._compatiblee   s=   € Ø�Š6ˆ6Ø�4Ý1ð 	ð 	ˆCØ�Cˆxˆx˜A ˜H˜HØ�t�tøØˆur   c                 óp   — d }| D ]#\  }}|€|d u }Œ|d u |k    rt          d¦  «        ‚Œ$t          |¦  «        S )Nz5format string mixes positional and named placeholders)r   Úbool)ÚresultsÚ
positionalr-   Úchars       r   Ú_check_positionalz+_validate_format.<locals>._check_positionalm   sl   € Øˆ
Ø!ð 	Eð 	E‰JˆD�$ØÐ!Ø! T˜\�
�
à˜D�L ZÒ/Ð/Ý*ð ,Dñ Eô Eð Eð 0õ �JÑÔÐr   zplaceholders are incompatiblez)the format strings are of different kindsz-positional format placeholders are unbalancedzDincompatible format for placeholder %d: %r and %r are not compatibleé   zunknown named placeholder %rz$incompatible format for placeholder z: z and z are not compatibleN)Úmapr   r   Ú	enumerater   Údict)r.   Úalternativer0   r6   r<   r3   r4   Úa_positionalÚb_positionalÚidxÚ_ÚfirstÚsecondÚtype_mapr-   r/   s                   r   r    r    <   s  € ð@ð ð ðð ð ð	 ð 	 ð 	 õ ˆv˜ Ð,Ñ-Ô-�D€A€qõ "%Ð%6¸¸A¸Ñ!?Ô!?Ñ€L�,Øð L˜Lð L°ð LÝÐ>Ñ?Ô?Ð?Ø	˜Ò	%Ð	%ÝÐJÑKÔKÐKð ð IÝˆq‰6Œ6•S˜‘V”VÒÐÝ"ð $0ñ 1ô 1ð 1å.7½¸A¸q¹	¼	Ñ.BÔ.Bð 	Að 	AÑ*ˆCÑ*‘*�1�e™k˜q &Ø�;˜u fÑ-Ô-ð AÝ&ð (Jà(+¨a©°¸Ð'?ñ(@ñ Aô Að AðAð	Að 	Aõ ˜‘7”7ˆØð 	Ið 	I‰NˆD�(Ø˜8Ð#Ð#Ý&Ð'EÈÑ'LÑMÔMÐMØ �[ ¨8°D¬>Ñ:Ô:ð IÝ&Ð&ð )-¨¨¨h¨h¨h¸À¼¸¸ð(Hñ Iô Ið IðIð	Ið 	Ir   c                  óú   — g } 	 ddl m} |                     d¦  «        D ])}|                      |                     ¦   «         ¦  «         Œ*n# t
          $ r Y nw xY wt          | ¦  «        dk    rt          t          gS | S )Nr   )Úworking_setzbabel.checkers)	Úpkg_resourcesrJ   Úiter_entry_pointsr*   ÚloadÚImportErrorr   r   r$   )ÚcheckersrJ   Úentry_points      r   Ú_find_checkersrQ   ›   s«   € Ø€Hð0Ø-Ð-Ð-Ð-Ð-Ð-ð '×8Ò8Ð9IÑJÔJð 	0ð 	0ˆKØ�OŠO˜K×,Ò,Ñ.Ô.Ñ/Ô/Ð/Ð/ð	0øõ ð ð ð Øˆðøøøõ
 ˆ8�}„}˜ÒÐõ �]Ð+Ð+Ø€Os   „A
 Á

AÁAN)
Ú__doc__Úbabel.messages.catalogr   r   r2   r   r$   r    rQ   rO   © r   r   ú<module>rU      s¡   ðð
ð 
ð CÐ BÐ BÐ BÐ BÐ BÐ BÐ Bð
 €O€OØˆ#€JØÐÐð"Ð ð4ð 4ð 4ð(,ð ,ð ,ð \Ið \Ið \Ið~ð ð ð  ˆ>ÑÔ€€€r   