+
    *:žgK  ã                  ó    a € 0 t $ R t^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
 0 RmRR00 Rm.tR R ltR R	 ltR
 R ltR R lt]! 4       tR]R&   R# )zÞ
babel.messages.checkers
~~~~~~~~~~~~~~~~~~~~~~~

Various routines that help with validation of translations.

:since: version 0.9

:copyright: (c) 2013-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
)Úannotations)ÚCallable)ÚPYTHON_FORMATÚCatalogÚMessageÚTranslationErrorÚxÚXc               ó$   € V ^8„  d   QhRRRRRR/# ©é   ÚcatalogzCatalog | NoneÚmessager   ÚreturnÚNone© )Úformats   "Ú9/usr/lib/python3/dist-packages/babel/messages/checkers.pyÚ__annotate__r      s!   € ÷ 4ñ 4˜ð 4°'ð 4¸dñ 4ó    c                óR  € VP                   '       g.   \        VP                  \        4      '       g   \	        R4      hR# V f   R# VP                  p\        V\
        \        34      '       g   V3p\        V4      V P                  8w  d   \	        RV P                  ,          4      hR# )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)r   r   Úmsgstrss   && r   r   r      s”   € à××ÐÜ˜'Ÿ.™.¬#×.Ò.Ü"ð $-ó .ð .áð 
ŠÙà�n‰n€GÜ�g¤¤e˜}×-Ò-Ø�*ˆÜ
ˆ7ƒ|�w×*Ñ*Ô*ÜÐKØ&×2Ñ2õ 3ó 4ð 	4ñ +r   c               ó$   € V ^8„  d   QhRRRRRR/# r   r   )r   s   "r   r   r   .   s!   € ÷ ,ñ ,˜>ð ,°Gð ,Àñ ,r   c                ó*  € RVP                   9  d   R# VP                  p\        V\        \        34      '       g   V3pVP
                  p\        V\        \        34      '       g   V3p\        W#4       F  w  rEV'       g   K  \        WE4       K  	  R# )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)   .   sq   € à˜gŸm™mÔ+ÙØ�Z‰Z€FÜ�fœt¤U˜m×,Ò,Ø�ˆØ�n‰n€GÜ�g¤¤e˜}×-Ò-Ø�*ˆä˜VÖ-‰ˆß‰6Ü˜UÖ+ó .r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   Úalternativer   r   r   )r   s   "r   r   r   >   s&   € ÷ \ñ \˜Sð \¨sð \°tñ \r   c           
     ó–  € R R lpR R lpR R lp\        W V34      w  rVV'       g   R# \        WEV34      w  rxV'       d   V'       g   V'       g   \        R4      hWx8w  d   \        R	4      hV'       du   \        V4      \        V4      8w  d   \        R
4      h\        \	        WV4      4       F6  w  p	w  w  r«w  r¬V! W¼4      '       d   K  \        RV	^,           W¼3,          4      h	  R# \        V4      pV FM  w  rïWí9  d   \        RV: 24      hV! WýV,          4      '       d   K1  \        RV: RV: RWÞ,          : R24      h	  R# )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.

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               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   úlist[tuple[str, str]]r   )r   s   "r   r   Ú&_validate_format.<locals>.__annotate__[   s   € ÷ ñ �sð Ð4ñ r   c                ó¼   € . p\         P                  ! V 4       F?  pVP                  4       w  r4pVR 8X  d   Vf   K#  VP                  V\	        V4      34       KA  	  V# )Ú%)r   ÚfinditerÚgroupsÚappendr   )r   ÚresultÚmatchÚnamer   Útypechars   &     r   Ú_parseÚ _validate_format.<locals>._parse[   sV   € Ø(*ˆÜ"×+Ò+¨FÖ3ˆEØ%*§\¡\£^Ñ"ˆD˜(Ø˜3Œ 4¢<ÙØ�M‰M˜4¤ X£Ð/Ö0ñ	 4ð
 ˆr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úar   Úbr   Úboolr   )r   s   "r   r   r/   d   s!   € ÷ ñ �sð ˜sð  tñ r   c                óR   € W8X  d   R # \          F  pW9   g   K  W9   g   K   R # 	  R# )TF)Ú_string_format_compatibilities)r<   r=   Úsets   && r   Ú_compatibleÚ%_validate_format.<locals>._compatibled   s%   € ØŒ6Ùß1ˆCØŽx˜AžHÚñ 2ñ r   c               ó    € V ^8„  d   QhRRRR/# )r   Úresultsr.   r   r>   r   )r   s   "r   r   r/   l   s   € ÷ 	 ñ 	 Ð#8ð 	 ¸Tñ 	 r   c                ón   € R pV  F#  w  r#Vf   VR J pK  VR J V8w  g   K  \        R4      h	  \        V4      # )Nz5format string mixes positional and named placeholders)r   r>   )rE   Ú
positionalr7   Ú_chars   &   r   Ú_check_positionalÚ+_validate_format.<locals>._check_positionall   sP   € Øˆ
Û"‰KˆDØÒ!Ø! T˜\’
à˜D�L ZÖ/Ü*ð ,Dó Eð Eñ #ô �JÓÐr   Nzplaceholders are incompatiblez)the format strings are of different kindsz-positional format placeholders are unbalancedzDincompatible format for placeholder %d: %r and %r are not compatiblezunknown named placeholder z$incompatible format for placeholder z: z and z are not compatible)Úmapr   r   Ú	enumerater$   Údict)r   r+   r9   rB   rI   r<   r=   Úa_positionalÚb_positionalÚidxÚ_ÚfirstÚsecondÚtype_mapr7   r8   s   &&              r   r%   r%   >   sJ  € õ:õõ	 ô ˆv Ð,Ó-�D€AçÙô "%Ð%6¸A¸Ó!?Ñ€LßŸL·ÜÐ>Ó?Ð?Ø	Ô	%ÜÐJÓKÐK÷ Üˆq‹6”S˜“VÔÜ"ð $0ó 1ð 1ä.7¼¸A»	Ö.BÑ*ˆCÑ*‘*�1™k˜qÙ˜u×-Ô-Ü&ð (Jà(+¨a­°Ð'?õ(@ó Að Aó /Cô ˜“7ˆÛ‰NˆDØÔ#Ü&Ð)CÀDÁ8Ð'LÓMÐMÙ  °D­>×:Ô:Ü&Ø:¸4¹(À"Ø‘l %¨­Ñ'9Ð9LðNóð ó	  r   c               ó   € V ^8„  d   QhRR/# )r   r   ú1list[Callable[[Catalog | None, Message], object]]r   )r   s   "r   r   r   �   s   € ÷ ñ ÐIñ r   c                 óŠ   € ^ RI Hp  . pVP                  R V ! R4       4       4       \        V4      ^ 8X  d   \        \
        .# V# )é    )Úfind_entrypointsc              3  ó4   "  € T F  w  rV! 4       x € K  	  R # 5i)Nr   )Ú.0r7   Úloads   &  r   Ú	<genexpr>Ú!_find_checkers.<locals>.<genexpr>    s   é € ÐRÑ/Q™| ‘D—F�FÓ/Qùs   ‚zbabel.checkers)Úbabel.messages._compatrY   Úextendr   r   r)   )rY   Úcheckerss     r   Ú_find_checkersrb   �   sA   € Ý7ØBD€HØ‡O�OÑRÑ/?Ð@PÔ/QÓRÔRÜ
ˆ8ƒ}˜Ôô œ]Ð+Ð+Ø€Or   rV   ra   N>   ÚdÚiÚu>   ÚFÚGÚfÚg)Ú__conditional_annotations__Ú__doc__Ú
__future__r   Úcollections.abcr   Úbabel.messages.catalogr   r   r   r   r@   r   r)   r%   rb   ra   Ú__annotations__)rj   s   @r   Ú<module>rp      sW   øðô
õ #å $ç TÓ Tò Øˆ#€JÚð"Ð õ4õ(,õ \õ~ñ ?MÓ>N€Ð
;Õ Nr   