/usr/lib/python2.6/site-packages/babel/messages
NameSizeModeActions
catalog.py310610644editdlrm
catalog.pyc303970644editdlrm
checkers.py60940644editdlrm
checkers.pyc56910644editdlrm
extract.py226950644editdlrm
extract.pyc174330644editdlrm
frontend.py522120644editdlrm
frontend.pyc422090644editdlrm
jslexer.py53170644editdlrm
jslexer.pyc51870644editdlrm
mofile.py69530644editdlrm
mofile.pyc55890644editdlrm
plurals.py66960644editdlrm
plurals.pyc66240644editdlrm
pofile.py163200644editdlrm
pofile.pyc145690644editdlrm
__init__.py2490644editdlrm
__init__.pyc3990644editdlrm
Edit: /usr/lib/python2.6/site-packages/babel/messages/pofile.pyc (14569B)
Ñò zDVc @sÄdZddkZddkZddklZlZddklZddkl Z d„Z d„Z dde dd„Zeid ƒZd „Zd d d „Zd e e e e e e d„ZdS(sé babel.messages.pofile ~~~~~~~~~~~~~~~~~~~~~ Reading and writing of files in the ``gettext`` PO (portable object) format. :copyright: (c) 2013 by the Babel Team. :license: BSD, see LICENSE for more details. iÿÿÿÿN(tCatalogtMessage(twraptext(t text_typecCs)d„}tidƒi||dd!ƒS(s¾Reverse `escape` the given string. >>> print unescape('"Say:\\n \\"hello, world!\\"\\n"') Say: "hello, world!" :param string: the string to unescape cSsI|idƒ}|djodS|djodS|djodS|S(Nitns tts trs (tgroup(tmatchtm((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pytreplace_escapess   s \\([\\trn"])iiÿÿÿÿ(tretcompiletsub(tstringR ((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pytunescapes cCsbd|joG|iƒ}|idƒo|d}ntt|ƒ}di|ƒSt|ƒSdS(sêReverse the normalization done by the `normalize` function. >>> print denormalize(r'''"" ... "Say:\n" ... " \"hello, world!\"\n"''') Say: "hello, world!" >>> print denormalize(r'''"" ... "Say:\n" ... " \"Lorem ipsum dolor sit " ... "amet, consectetur adipisicing" ... " elit, \"\n"''') Say: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " :param string: the string to denormalize s s""itN(t splitlinest startswithtmapRtjoin(Rt escaped_linestlines((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt denormalize,s  c sRtd|d|d|ƒ‰dg‰ dg‰g‰ g‰g‰g‰ g‰g‰tg‰g‰ tg‰tg‰tg‰ ‡‡‡‡‡‡‡‡ ‡ ‡ ‡ ‡f d†‰‡ ‡‡‡ ‡‡‡ ‡fd†}xt|iƒƒD] \}}|iƒ}t|tƒp|iˆiƒ}n|i dƒo¯tˆd<ˆd<ˆ oˆo ˆƒn|di d ƒoxi|d i ƒi ƒD]n}|i d ƒ} | djoLyt || dƒ}Wntj o q†nXˆi|| |fƒq†q†Wqì|di d ƒo;xÈ|d i ƒi d ƒD]} ˆ i| iƒƒq*Wqì|di d ƒo%tˆd<|||d i ƒƒqì|di d ƒo,|d iƒ} | oˆi| ƒqÛqìˆi|diƒƒqâ|||ƒqâWˆ o ˆƒnMˆ d o@ˆ pˆpˆo+ˆ idƒˆiddgƒˆƒnˆS(sJRead messages from a ``gettext`` PO (portable object) file from the given file-like object and return a `Catalog`. >>> from datetime import datetime >>> from StringIO import StringIO >>> buf = StringIO(''' ... #: main.py:1 ... #, fuzzy, python-format ... msgid "foo %(name)s" ... msgstr "quux %(name)s" ... ... # A user comment ... #. An auto comment ... #: main.py:3 ... msgid "bar" ... msgid_plural "baz" ... msgstr[0] "bar" ... msgstr[1] "baaz" ... ''') >>> catalog = read_po(buf) >>> catalog.revision_date = datetime(2007, 04, 01) >>> for message in catalog: ... if message.id: ... print (message.id, message.string) ... print ' ', (message.locations, message.flags) ... print ' ', (message.user_comments, message.auto_comments) (u'foo %(name)s', u'quux %(name)s') ([(u'main.py', 1)], set([u'fuzzy', u'python-format'])) ([], []) ((u'bar', u'baz'), (u'bar', u'baaz')) ([(u'main.py', 3)], set([])) ([u'A user comment'], [u'An auto comment']) .. versionadded:: 1.0 Added support for explicit charset argument. :param fileobj: the file-like object to read the PO file from :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 ignore_obsolete: whether to ignore obsolete messages in the input :param charset: the character set of the catalog. tlocaletdomaintcharsetic sçˆiƒtˆƒdjo1tg}ˆD]}|t|ƒq+~ƒ}ntˆdƒ}t|ttfƒo“g}xUtˆiƒD]D}y|iˆ|ƒWqŠt j o|i|dfƒqŠXqŠWtg}|D]}|t|dƒqà~ƒ}ntˆddƒ}ˆ otdi ˆ ƒƒ}nd}t ||tˆƒt ˆ ƒˆˆdˆddd|ƒ}ˆdoˆ p|ˆi|      #   " t#it:it,t~t.u(RR)t enumeratet readlineststripR RtdecodeRRRARBtrfindRCt ValueErrorR$R@( tfileobjRRR9RRKRREtlocationtpostflagtcomment((R0R1R2RIR3RJR(R4R5RHR6R7R8RR9R:s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pytread_poKsn.      0!$"    #  !  sL(\s+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))cCsDd|iddƒiddƒiddƒidd ƒid d ƒS( sõEscape the given string so that it can be included in double-quoted strings in ``PO`` files. >>> escape('''Say: ... "hello, world!" ... ''') '"Say:\\n \\"hello, world!\\"\\n"' :param string: the string to escape s"%s"s\s\\s s\ts s\rs s\ns"s\"(treplace(R((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pytescapes    RiLc CsË|o3|djo&t|ƒ}g}x |itƒD]ü}tt|ƒƒ||joÌti|ƒ}|iƒx½|o¤g}d}x{|ostt|dƒƒd|} || |jo!|i|iƒƒ|| 7}q‹|p|i|iƒƒnPq‹W|idi |ƒƒquWq6|i|ƒq6Wn|itƒ}t|ƒdjo t|ƒS|o'|d o|d=|dcd7>> print normalize('''Say: ... "hello, world!" ... ''', width=None) "" "Say:\n" " \"hello, world!\"\n" >>> print normalize('''Say: ... "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " ... ''', width=32) "" "Say:\n" " \"Lorem ipsum dolor sit " "amet, consectetur adipisicing" " elit, \"\n" :param string: the string to normalize :param prefix: a string that should be prepended to every line :param width: the maximum line width; use `None`, 0, or a negative number to completely disable line wrapping iiiÿÿÿÿuis u"" u ( RRR@R^tWORD_SEPRBtreverseR$tpopR( Rtprefixtwidtht prefixlenRREtchunkstbuftsizetlR*((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt normalizes<   c sõd‡fd†‰‡‡fd†‰d‡‡fd†} d‡‡‡fd†} tˆƒ} |o| iƒn|o| id„ƒnx| D]ü} | ip‰|oq”nˆi} ˆoYˆdjoLg}x0| iƒD]"}|t|dˆd d ƒ7}qâWd i|ƒ} nˆ| d ƒnx| iD]}| |ƒq7Wx!| iD]}| |d d ƒqUW|p`dig}| i D],\}}|d|i t i dƒ|fqŠ~ƒ}| |d dƒn| i o+ˆddidgt| i ƒƒƒn| iog|o`| dˆ| idƒd dƒt| iƒdjo%| dˆ| idƒd dƒq|n| | ƒˆdƒq”W|pVxSˆiiƒD]>} x| iD]}| |ƒq»W| | d dƒˆdƒq«WndS(svWrite a ``gettext`` PO (portable object) template file for a given message catalog to the provided file-like object. >>> catalog = Catalog() >>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)], ... flags=('fuzzy',)) >>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)]) >>> from io import BytesIO >>> buf = BytesIO() >>> write_po(buf, catalog, omit_header=True) >>> print buf.getvalue() #: main.py:1 #, fuzzy, python-format msgid "foo %(name)s" msgstr "" #: main.py:3 msgid "bar" msgid_plural "baz" msgstr[0] "" msgstr[1] "" :param fileobj: the file-like object to write to :param catalog: the `Catalog` instance :param width: the maximum line width for the generated output; use `None`, 0, or a negative number to completely disable line wrapping :param no_location: do not emit a location comment for every message :param omit_header: do not include the ``msgid ""`` entry at the top of the output :param sort_output: whether to sort the messages in the output by msgid :param sort_by_file: whether to sort the messages in the output by their locations :param ignore_obsolete: whether to ignore obsolete messages and not include them in the output; by default they are included as comments :param include_previous: include the old msgid as a comment when updating the catalog Rcst|d|dˆƒS(NRbRc(Ri(tkeyRb(Rc(s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt _normalize~scs:t|tƒo|iˆidƒ}nˆi|ƒdS(Ntbackslashreplace(R RtencodeRtwrite(ttext(R4RW(s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt_writescs\ˆoˆdjo ˆ}nd}x1t||ƒD] }ˆd||iƒfƒq4WdS(NiiLs#%s %s (RRS(R[Rbt_widthRE(RcRp(s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt_write_comment†s  c sst|ittfƒoá|io$ˆd|ˆ|i|ƒfƒnˆd|ˆ|id|ƒfƒˆd|ˆ|id|ƒfƒxÝtˆiƒD]S}y|i|}Wntj o d}nXˆd||ˆ||ƒfƒqŸWnv|io$ˆd|ˆ|i|ƒfƒnˆd|ˆ|i|ƒfƒˆd|ˆ|ipd|ƒfƒdS( Ns %smsgctxt %s s %smsgid %s is%smsgid_plural %s iRs%smsgstr[%d] %s s %smsgstr %s ( R tidR!RRR"R#RR%(R/RbR,R(R4RkRp(s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt_write_messages*  $ "   cSst|i|iƒS((tcmpR0(txty((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt¯siRctsubsequent_indents# u RbRPu u%s:%dt/RMs#%s s, smsgid %st|ismsgid_plural %ss s#~ N(R!RRstheader_commentRRRR1R2R0R]tostsepR8tsortedt previous_idRR(tvalues(RWR4Rct no_locationt omit_headert sort_outputt sort_by_fileR9tinclude_previousRrRtR7R/tcomment_headerRRER[R*tfilenameRtlocs((RWRpRcR4Rks4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pytwrite_poQsh-        ? +   (t__doc__R}R tbabel.messages.catalogRRt babel.utilRt babel._compatRRRR&R)R\R R_R^RiRŠ(((s4/tmp/pip-build-lt8jXN/Babel/babel/messages/pofile.pyt s    ° =