ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4\0Xc@sdZddlmZmZddlmZmZedddgeddged d d d ggZd Z dZ dZ dZ e Z dS(s babel.messages.checkers ~~~~~~~~~~~~~~~~~~~~~~~ Various routines that help with validation of translations. :since: version 0.9 :copyright: (c) 2013 by the Babel Team. :license: BSD, see LICENSE for more details. i(tTranslationErrort PYTHON_FORMAT(t string_typestiziptitdtutxtXtftFtgtGcCs|js.t|jts*tdndS|dkr>dS|j}t|ttfsh|f}nt||j krtd|j ndS(s0Verify the number of plurals in the translation.s/Found plural forms for non-pluralizable messageNs*Wrong number of plural forms (expected %d)( t pluralizablet isinstancetstringRRtNonetlistttupletlent num_plurals(tcatalogtmessagetmsgstrs((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyRs    cCsd|jkrdS|j}t|ttfs=|f}n|j}t|ttfsg|f}nx3t||D]"\}}|rwt||qwqwWdS(s9Verify the format string placeholders in the translation.s python-formatN(tflagstidRRRRRt_validate_format(RRtmsgidsRtmsgidtmsgstr((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt python_format.s    cCsd}d}d}t|||f\}}t|||f\}}|rt| rt| rttdn||krtdn|r&t|t|krtdnxtt||D]M\} \\} } \} } || | std| d| | fqqWnut|} xf|D]^\}}|| krdtd |q9||| |s9td ||| |fq9q9Wd S( sTest 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 cSspg}xctj|D]R}|j\}}}|dkrO|dkrOqn|j|t|fqW|S(Nt%(RtfinditertgroupsRtappendtstr(Rtresulttmatchtnametformatttypechar((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt_parse^scSsA||krtSx*tD]"}||kr||krtSqWtS(N(tTruet_string_format_compatibilitiestFalse(tatbtset((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt _compatiblegs   cSscd}xP|D]H\}}|dkr4|dk}q |dk|kr tdq q Wt|S(Ns5format string mixes positional and named placeholders(RRtbool(tresultst positionalR&tchar((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt_check_positionalos splaceholders are incompatibles)the format strings are of different kindss-positional format placeholders are unbalancedsDincompatible format for placeholder %d: %r and %r are not compatibleisunknown named placeholder %rsDincompatible format for placeholder %r: %r and %r are not compatibleN(tmapRRt enumerateRtdict(R't alternativeR)R0R5R-R.t a_positionalt b_positionaltidxt_tfirsttsecondttype_mapR&R(((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyR>s.   4!  cCs{g}yddlm}Wntk r-n.Xx*|jdD]}|j|jq>Wt|dkrwttgS|S(Ni(t working_setsbabel.checkersi( t pkg_resourcesRAt ImportErrortiter_entry_pointsR"tloadRRR(tcheckersRAt entry_point((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt_find_checkerss  N(t__doc__tbabel.messages.catalogRRt babel._compatRRR/R+RRRRHRF(((s;/usr/lib/python2.7/site-packages/babel/messages/checkers.pyt s   _