Ë
    Æªbu  ã                   óT   — 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	y)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«      ‚y| €y|j                  }t        |t
        t        f«      s|f}t        |«      | j                  k7  rt	        d| j                  z  «      ‚y)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‰n€GÜ�g¤¤e˜}Ô-Ø�*ˆÜ
ˆ7ƒ|�w×*Ñ*Ò*ÜÐKØ&×2Ñ2ñ 3ó 4ð 	4ð +ó    c                 óü   — d|j                   vry|j                  }t        |t        t        f«      s|f}|j
                  }t        |t        t        f«      s|f}t        ||«      D ]  \  }}|sŒ	t        ||«       Œ y)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$   ,   st   € à˜gŸm™mÑ+ØØ�Z‰Z€FÜ�fœt¤U˜mÔ,Ø�ˆØ�n‰n€GÜ�g¤¤e˜}Ô-Ø�*ˆä˜V WÓ-ò ,‰ˆˆvÚÜ˜U FÕ+ñ,r   c           
      ó  — d„ }d„ }d„ }t        || |f«      \  }}t        |||f«      \  }}|r|s|st        d«      ‚||k7  rt        d«      ‚|rft        |«      t        |«      k7  rt        d«      ‚t        t	        ||«      «      D ]+  \  }	\  \  }
}\  }
} |||«      rŒt        d|	dz   ||fz  «      ‚ yt        |«      }|D ];  \  }}||vrt        d	|z  «      ‚ ||||   «      rŒ%t        d
|›d|›d||   ›d�«      ‚ y)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 ]:  }|j                  «       \  }}}|dk(  r|€Œ|j                  |t	        |«      f«       Œ< |S )Nú%)r   ÚfinditerÚgroupsÚappendr   )r   ÚresultÚmatchÚnameÚformatÚtypechars         r   Ú_parsez _validate_format.<locals>._parse\   s]   € ØˆÜ"×+Ñ+¨FÓ3ò 	1ˆEØ%*§\¡\£^Ñ"ˆD�&˜(Ø˜3Š 4 <ØØ�M‰M˜4¤ X£Ð/Õ0ð		1ð
 ˆr   c                 ó<   — | |k(  ryt         D ]  }| |v sŒ||v sŒ y y)NTF)Ú_string_format_compatibilities)ÚaÚbÚsets      r   Ú_compatiblez%_validate_format.<locals>._compatiblee   s0   € Ø�Š6ØÜ1ò 	ˆCØ�CŠx˜A šHÙð	ð r   c                 ób   — d }| D ]  \  }}|€|d u }Œ|d u |k7  sŒt        d«      ‚ t        |«      S )Nz5format string mixes positional and named placeholders)r   Úbool)ÚresultsÚ
positionalr-   Úchars       r   Ú_check_positionalz+_validate_format.<locals>._check_positionalm   sY   € Øˆ
Ø!ò 	E‰JˆD�$ØÐ!Ø! T˜\‘
à˜D�L ZÓ/Ü*ð ,Dó Eð Eð	Eô �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    <   sY  € ò@òò	 ô ˆv˜ Ð,Ó-�D€A€qô "%Ð%6¸¸A¸Ó!?Ñ€L�,Ù™L±ÜÐ>Ó?Ð?Ø	˜Ò	%ÜÐJÓKÐKñ Üˆq‹6”S˜“VÒÜ"ð $0ó 1ð 1ä.7¼¸A¸q»	Ó.Bò 	AÑ*ˆCÑ*‘*�1�e™k˜q &Ù˜u fÕ-Ü&ð (Jà(+¨a©°¸Ð'?ñ(@ó Að Añ	Aô ˜“7ˆØò 	I‰NˆD�(Ø˜8Ñ#Ü&Ð'EÈÑ'LÓMÐMÙ  ¨8°D©>Õ:Ý&ò )-ªh¸À»ð(Hó Ið Iñ		Ir   c                  óÖ   — g } 	 ddl m} |j                  d«      D ]!  }| j                  |j	                  «       «       Œ# 	 t        | «      dk(  rt        t        gS | S # t
        $ r Y Œ'w xY w)Nr   )Úworking_setzbabel.checkers)	Úpkg_resourcesrJ   Úiter_entry_pointsr*   ÚloadÚImportErrorr   r   r$   )ÚcheckersrJ   Úentry_points      r   Ú_find_checkersrQ   ›   ss   € Ø€Hð0Ý-ð '×8Ñ8Ð9IÓJò 	0ˆKØ�O‰O˜K×,Ñ,Ó.Õ/ñ	0ä
ˆ8ƒ}˜Òô œ]Ð+Ð+Ø€Oøô ò Ùðús   „A Á	A(Á'A(N)
Ú__doc__Úbabel.messages.catalogr   r   r2   r   r$   r    rQ   rO   © r   r   ú<module>rU      sH   ðñ
÷ Cò
 Øˆ#€JÚð"Ð ò4ò(,ò \Iò~ñ  Ó�r   