/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/catalog.pyc (30397B)
Ñò zDVc@s…dZddkZddkZddklZddklZlZddklZddk l Z ddk l Z ddk l Zdd klZdd klZdd klZdd klZlZlZlZdd klZlZlZlZdddgZei dƒZ!d„Z"de#fd„ƒYZ$de%fd„ƒYZ&dZ'eo d„Z(ne Z(de#fd„ƒYZ)dS(sÀ babel.messages.catalog ~~~~~~~~~~~~~~~~~~~~~~ Data structures for message catalogs. :copyright: (c) 2013 by the Babel Team. :license: BSD, see LICENSE for more details. iÿÿÿÿN(t parse_header(tdatetimettime(tget_close_matches(tmessage_from_string(tcopy(t __version__(tLocale(tformat_datetime(t get_plural(todicttdistincttLOCALTZtFixedOffsetTimezone(t string_typest number_typestPY2tcmptMessagetCatalogtTranslationErrors¬(?x) \% (?:\(([\w]*)\))? ( [-#0\ +]?(?:\*|[\d]+)? (?:\.(?:\*|[\d]+))? [hlL]? ) ([diouxXeEfFgGcrs%]) cCsýtid|ƒ}ti|idƒdƒ}ti|ƒ}ti|ƒ}|idƒ}|dj o’|d|d}}|d |d}} t |dƒ} t |ƒ} t | ƒ} | d } | | 7} | | 9} t | ƒ}|i d |ƒ}n|S( Ns+^(?P.*?)(?P[+-]\d{4})?$Rs%Y-%m-%d %H:%Mttzoffsetiiit1i<ttzinfo( tretmatchRtstrptimetgrouptmktimeRt fromtimestamptNonetintR treplace(tvalueRtttttstdtRt plus_minus_strestthours_offset_st mins_offset_st plus_minust hours_offsett mins_offsettnet_mins_offset((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_parse_datetime_header+s"       c Bs¹eZdZddddddddd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z dd „Zed „ƒZed„ƒZed„ƒZRS(s0Representation of a single message in a catalog.uc Csö||_| o|io d}n||_tt|ƒƒ|_t|ƒ|_|o|io|ii dƒn|ii dƒtt|ƒƒ|_ tt|ƒƒ|_ t |tƒo|g|_nt|ƒ|_||_| |_dS(s`Create the message object. :param id: the message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param string: the translated message string, or a ``(singular, plural)`` tuple for pluralizable messages :param locations: a sequence of ``(filenname, lineno)`` tuples :param flags: a set or sequence of flags :param auto_comments: a sequence of automatic comments for the message :param user_comments: a sequence of user comments for the message :param previous_id: the previous message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param lineno: the line number on which the msgid line was found in the PO file, if any :param context: the message context us python-formatN(uu(tidt pluralizabletstringtlistR t locationstsettflagst python_formattaddtdiscardt auto_commentst user_commentst isinstanceRt previous_idtlinenotcontext( tselfR.R0R2R4R8R9R;R<R=((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__init__Ns     cCs&dt|ƒi|it|iƒfS(Ns<%s %r (flags: %r)>(ttypet__name__R.R1R4(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__repr__sscs.‡‡fd†}|ƒ\}}t||ƒS(s0Compare Messages, taking into account plural idscs•tˆtƒouˆi}ˆi}|o |oˆidˆidfS|oˆidˆifS|oˆiˆidfSnˆiˆifS(Ni(R:RR/R.(tpluralt obj_plural(tobjR>(s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pytvalues_to_compareys  (R(R>RERFtthistother((RER>s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__cmp__ws cCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__gt__‡scCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__lt__ŠscCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__ge__scCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__le__scCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__eq__“scCs|i|ƒdjS(Ni(RI(R>RH((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__ne__–sc CsIttt|i|i|i|i|i|i|i |i |i f ƒŒS(N( RtmapRR.R0R2R4R8R9R;R<R=(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pytclone™s  cCsaddkl}g}xD|D]<}y|||ƒWqtj o}|i|ƒqXqW|S(s•Run various validation checks on the message. Some validations are only performed if the catalog is provided. This method returns a sequence of `TranslationError` objects. :rtype: ``iterator`` :param catalog: A catalog instance that is passed to the checkers :see: `Catalog.check` for a way to perform checks for all messages in a catalog. iÿÿÿÿ(tcheckers(tbabel.messages.checkersRRRtappend(R>tcatalogRRterrorstcheckerte((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pytcheckŸs cCs d|ijS(sWhether the translation is fuzzy. >>> Message('foo').fuzzy False >>> msg = Message('foo', 'foo', flags=['fuzzy']) >>> msg.fuzzy True >>> msg :type: `bool`tfuzzy(R4(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRZ²s cCst|ittfƒS(s¯Whether the message is plurizable. >>> Message('foo').pluralizable False >>> Message(('foo', 'bar')).pluralizable True :type: `bool`(R:R.R1ttuple(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR/Ás cCs@|i}t|ttfƒp |g}ntd„|DƒƒS(sâWhether the message contains Python-style parameters. >>> Message('foo %(name)s bar').python_format True >>> Message(('foo %(name)s', 'foo %(name)s')).python_format True :type: `bool`css"x|]}ti|ƒVqWdS(N(t PYTHON_FORMATtsearch(t.0R.((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pys Ús (R.R:R1R[tany(R>tids((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR5Ís  (((((N(RAt __module__t__doc__RR?RBRIRJRKRLRMRNRORQRYtpropertyRZR/R5(((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRKs  $           cBseZdZRS(s_Exception thrown by translation checkers when invalid message translations are encountered.(RARaRb(((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRÝsu¸# Translations template for PROJECT. # Copyright (C) YEAR ORGANIZATION # This file is distributed under the same license as the PROJECT project. # FIRST AUTHOR , YEAR. #cCsdt|idƒƒ}h}xB|iƒD]4\}}|idƒ}|idƒ}|||sLANGUAGE sutf-8RsYEAR-MO-DA HO:MI+ZONEN(tdomainRtparsetlocalet_header_commentR t _messagestprojecttversiontcopyright_holdertmsgid_bugs_addresstlast_translatort language_teamtcharsetRRtnowR R:RR t creation_datet revision_dateRZtobsoletet _num_pluralst _plural_expr(R>RrRptheader_commentRuRvRwRxR}R~RyRzR{RZ((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR?üs6            cCs·|i}titƒidƒ}t|idƒo|iidƒ}n|id|iƒid|i ƒid|ƒid|i ƒ}|i o |idd|i i ƒ}n|S( Ns%YtstrftimeRmRntYEARRosTranslations templates%s translations( RsRR|R RƒthasattrR~R RuRvRwRrt english_name(R>tcommenttyear((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_get_header_comment8s    cCs ||_dS(N(Rs(R>R0((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_set_header_commentFstdocsƒ The header comment for the catalog. >>> catalog = Catalog(project='Foobar', version='1.0', ... copyright_holder='Foo Company') >>> print catalog.header_comment #doctest: +ELLIPSIS # Translations template for Foobar. # Copyright (C) ... Foo Company # This file is distributed under the same license as the Foobar project. # FIRST AUTHOR , .... # The header can also be set from a string. Any known upper-case variables will be replaced when the header is retrieved again: >>> catalog = Catalog(project='Foobar', version='1.0', ... copyright_holder='Foo Company') >>> catalog.header_comment = '''\ ... # The POT for my really cool PROJECT project. ... # Copyright (C) 1990-2003 ORGANIZATION ... # This file is distributed under the same license as the PROJECT ... # project. ... #''' >>> print catalog.header_comment # The POT for my really cool Foobar project. # Copyright (C) 1990-2003 Foo Company # This file is distributed under the same license as the Foobar # project. # :type: `unicode` cCsäg}|idd|i|iffƒ|id|ifƒ|idt|idddƒfƒt|itt ft ƒo)|idt|idddƒfƒn|id|ifƒ|id |i fƒ|i dj o |id t|i ƒfƒn|i dj o?d |ijo/|id |iid t|i ƒƒfƒn|id |ifƒ|i dj o|id |ifƒn|idƒ|idd|ifƒ|idƒ|iddtfƒ|S(NsProject-Id-Versions%s %ssReport-Msgid-Bugs-TosPOT-Creation-Datesyyyy-MM-dd HH:mmZRrtensPO-Revision-DatesLast-TranslatortLanguagetLANGUAGEs Language-Teams Plural-Formss MIME-Versions1.0s Content-Typestext/plain; charset=%ssContent-Transfer-Encodingt8bits Generated-Bys Babel %s (s MIME-Versions1.0(sContent-Transfer-Encodings8bit(RTRuRvRxRR}R:R~Rttime_RRyRrRtstrRzR t plural_formsR{Rn(R>Ri((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_get_mime_headersjs8            cCs§x |D]˜\}}|iƒ}|djo6|idƒ}di|d ƒ|_|d|_q|djo ||_q|djo ||_q|djo ||_q|djo:t|ƒ\}}d |jo|d iƒ|_ qŸq|d joJtd |ƒ\}}t |i d d ƒƒ|_ |i ddƒ|_ q|djot|ƒ|_q|djo$d|jot|ƒ|_qŸqqWdS(Nsproject-id-versiont u iÿÿÿÿsreport-msgid-bugs-toslast-translators language-teams content-typeR{s plural-formss ;tnpluralsiRCs(n != 1)spot-creation-datespo-revision-dateR„(tlowertsplittjoinRuRvRxRyRzRR{RtgetR€RR-R}R~(R>RiRkR!tpartstmimetypetparamst_((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_set_mime_headersŠs4               sÁ The MIME headers of the catalog, used for the special ``msgid ""`` entry. The behavior of this property changes slightly depending on whether a locale is set or not, the latter indicating that the catalog is actually a template for actual translations. Here's an example of the output for such a catalog template: >>> from babel.dates import UTC >>> created = datetime(1990, 4, 1, 15, 30, tzinfo=UTC) >>> catalog = Catalog(project='Foobar', version='1.0', ... creation_date=created) >>> for name, value in catalog.mime_headers: ... print '%s: %s' % (name, value) Project-Id-Version: Foobar 1.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 1990-04-01 15:30+0000 PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE Last-Translator: FULL NAME Language-Team: LANGUAGE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel ... And here's an example of the output when the locale is set: >>> revised = datetime(1990, 8, 3, 12, 0, tzinfo=UTC) >>> catalog = Catalog(locale='de_DE', project='Foobar', version='1.0', ... creation_date=created, revision_date=revised, ... last_translator='John Doe ', ... language_team='de_DE ') >>> for name, value in catalog.mime_headers: ... print '%s: %s' % (name, value) Project-Id-Version: Foobar 1.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 1990-04-01 15:30+0000 PO-Revision-Date: 1990-08-03 12:00+0000 Last-Translator: John Doe Language: de_DE Language-Team: de_DE Plural-Forms: nplurals=2; plural=(n != 1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel ... :type: `list` cCsK|idjo4d}|iot|iƒd}n||_n|iS(s¹The number of plurals used by the catalog or locale. >>> Catalog(locale='en').num_plurals 2 >>> Catalog(locale='ga').num_plurals 3 :type: `int`iiN(R€RRrR (R>tnum((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt num_pluralsÙs   cCsK|idjo4d}|iot|iƒd}n||_n|iS(såThe plural expression used by the catalog or locale. >>> Catalog(locale='en').plural_expr '(n != 1)' >>> Catalog(locale='ga').plural_expr '(n==1 ? 0 : n==2 ? 1 : 2)' :type: `string_types`s(n != 1)iN(RRRrR (R>texpr((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt plural_exprês   cCsd|i|ifS(sôReturn the plural forms declaration for the locale. >>> Catalog(locale='en').plural_forms 'nplurals=2; plural=(n != 1)' >>> Catalog(locale='pt_BR').plural_forms 'nplurals=2; plural=(n > 1)' :type: `str`snplurals=%s; plural=%s(R R¢(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR’ûs cCs|i|ƒ|ijS(s?Return whether the catalog has a message with the specified ID.(t_key_forRt(R>R.((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt __contains__scCs t|iƒS(seThe number of messages in the catalog. This does not include the special ``msgid ""`` entry.(tlenRt(R>((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__len__ sccs¢g}x.|iD]#\}}|id||fƒqWtƒ}|io|tdgƒO}ntddi|ƒd|ƒVx|iD]}|i|VqˆWdS(s¡Iterates through all the entries in the catalog, in the order they were added, yielding a `Message` object for every entry. :rtype: ``iterator``s%s: %sRZus R4N(t mime_headersRTR3RZRR˜Rt(R>tbufRkR!R4tkey((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt__iter__s    cCs>d}|iod|i}ndt|ƒi|i|fS(Nts %ss <%s %r%s>(RrR@RARp(R>Rr((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRB s cCs|i|ƒdS(s)Delete the message with the specified ID.N(tdelete(R>R.((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt __delitem__&scCs |i|ƒS(sUReturn the message with the specified ID. :param id: the message ID (R™(R>R.((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt __getitem__*scCs¼t|tƒp td‚|i||iƒ}|ii|ƒ}|oª|io'|i o|i|_|i |_ nt t |i |i ƒƒ|_ t t |i |i ƒƒ|_ t t |i|iƒƒ|_|i|iO_|}nÇ|djobt|i ƒiƒ|_dig}|iD]}|d|iƒq+~ƒ|_|i|_nXt|t tfƒo4t|i t tfƒptdt|i ƒ‚n||i|>> catalog = Catalog() >>> catalog[u'foo'] = Message(u'foo') >>> catalog[u'foo'] If a message with that ID is already in the catalog, it is updated to include the locations and flags of the new message. >>> catalog = Catalog() >>> catalog[u'foo'] = Message(u'foo', locations=[('main.py', 1)]) >>> catalog[u'foo'].locations [('main.py', 1)] >>> catalog[u'foo'] = Message(u'foo', locations=[('utils.py', 5)]) >>> catalog[u'foo'].locations [('main.py', 1), ('utils.py', 5)] :param id: the message ID :param message: the `Message` object sexpected a Message objectR«s s# %ssExpected sequence but got %sN(R:RtAssertionErrorR£R=RtR™R/R.R0R1R R2R8R9R4RlRfR§R˜trstripR‚RZR[R@(R>R.tmessageR©tcurrentt_[1]tc((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt __setitem__1s0       -c Cs>t||t|ƒ||||d|d| ƒ} | ||<| S(suAdd or update the message with the specified ID. >>> catalog = Catalog() >>> catalog.add(u'foo') >>> catalog[u'foo'] This method simply constructs a `Message` object with the given arguments and invokes `__setitem__` with that object. :param id: the message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param string: the translated message string, or a ``(singular, plural)`` tuple for pluralizable messages :param locations: a sequence of ``(filenname, lineno)`` tuples :param flags: a set or sequence of flags :param auto_comments: a sequence of automatic comments :param user_comments: a sequence of user comments :param previous_id: the previous message ID, or a ``(singular, plural)`` tuple for pluralizable messages :param lineno: the line number on which the msgid line was found in the PO file, if any :param context: the message context R<R=(RR1( R>R.R0R2R4R8R9R;R<R=R±((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR6cs   ccsFx?|iiƒD].}|id|ƒ}|o||fVqqWdS(sBRun various validation checks on the translations in the catalog. For every message which fails validation, this method yield a ``(message, errors)`` tuple, where ``message`` is the `Message` object and ``errors`` is a sequence of `TranslationError` objects. :rtype: ``iterator`` RUN(RttvaluesRY(R>R±RV((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRY„s cCs|ii|i||ƒƒS(s©Return the message with the specified ID and context. :param id: the message ID :param context: the message context, or ``None`` for no context (RtR™R£(R>R.R=((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR™’scCs4|i||ƒ}||ijo|i|=ndS(s©Delete the message with the specified ID and context. :param id: the message ID :param context: the message context, or ``None`` for no context N(R£Rt(R>R.R=R©((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR¬šsc sˆi‰ˆiƒ‰tƒˆ_g}|pZtg}ˆD]<}|o/ˆ|io!|ˆi|ƒˆ|ifq<q<~ƒ}ntƒ‰‡‡‡‡fd†}x |D]}|ioòˆi|i|iƒ}|ˆjo||||ƒq²|t jo›t |t ƒo|d} n|} t | i ƒiƒ|iƒdƒ} | oH| d} || } | dj o| | f} n||| |ƒq°q¡n|ˆ|i>> from babel.messages import Catalog >>> template = Catalog() >>> template.add('green', locations=[('main.py', 99)]) >>> template.add('blue', locations=[('main.py', 100)]) >>> template.add(('salad', 'salads'), locations=[('util.py', 42)]) >>> catalog = Catalog(locale='de_DE') >>> catalog.add('blue', u'blau', locations=[('main.py', 98)]) >>> catalog.add('head', u'Kopf', locations=[('util.py', 33)]) >>> catalog.add(('salad', 'salads'), (u'Salat', u'Salate'), ... locations=[('util.py', 38)]) >>> catalog.update(template) >>> len(catalog) 3 >>> msg1 = catalog['green'] >>> msg1.string >>> msg1.locations [('main.py', 99)] >>> msg2 = catalog['blue'] >>> msg2.string u'blau' >>> msg2.locations [('main.py', 100)] >>> msg3 = catalog['salad'] >>> msg3.string (u'Salat', u'Salate') >>> msg3.locations [('util.py', 42)] Messages that are in the catalog but not in the template are removed from the main collection, but can still be accessed via the `obsolete` member: >>> 'head' in catalog False >>> catalog.obsolete.values() [] :param template: the reference catalog, usually read from a POT file :param no_fuzzy_matching: whether to use fuzzy matching of message IDs csÃ|iƒ}t}||jo^t}ˆi|ƒˆi|ƒ}t|itƒo|ig|_qt |iƒ|_nˆi |dƒ}|i |_ t|it t fƒo–t|i t t fƒp7t}t |i gdgt|iƒdƒ|_ q}t|i ƒˆijo)t}t |i t|i ƒ ƒ|_ q}n4t|i t t fƒot}|i d|_ n|i|iO_|o|itdgƒO_n|ˆ|itmessagest remaining(s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt_mergeæs4    .'iiN(RtRR tdictR0R£R=R3R.R·R:R[RR–tstriptkeysRRR}( R>ttemplatetno_fuzzy_matchingtfuzzy_candidatesR³tmsgidRÀR±R©tmatchkeytmatchesR»tnewctxt((R½R>R¿R¾s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pytupdate¤sF5   P        cCsK|}t|ttfƒo|d}n|dj o||f}n|S(s©The key for a message is just the singular ID even for pluralizable messages, but is a ``(msgid, msgctxt)`` tuple for context-specific messages. iN(R:R1R[R(R>R.R=R©((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyR£$s  N((((((RARaRbRtDEFAULT_HEADERR¸R?R‰RŠRcR‚R“RžR§R R¢R’R¤R¦RªRBR­R®RµR6RYR™R¬R·RËR£(((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyRùs>   8      1        2    €(*RbRRtcgiRRRtdifflibRtemailRRtbabelRRnt babel.coreRt babel.datesRtbabel.messages.pluralsR t babel.utilR R R R t babel._compatRRRRt__all__tcompileR\R-tobjectRt ExceptionRRÌRlR(((s5/tmp/pip-build-lt8jXN/Babel/babel/messages/catalog.pyt s0  ""  ’