ó ™‚Mc@s=dZddlZddlZdgZdZed„ZdS(s¿Writing of files in the ``gettext`` MO (machine object) format. :since: version 0.9 :see: `The Format of MO Files `_ iÿÿÿÿNtwrite_mosrestructuredtext enc Cs¬t|ƒ}|s?g|dD]}|js|^q|d)n|jƒd}}g}xp|D]h}|jr0djg|jD]} | j|jƒ^qƒ} g} xVt|j ƒD]E\} } | sî| j |jt t | ƒdƒƒq¶| j | ƒq¶Wdjg| D]} | j|jƒ^q ƒ} nK|jj|jƒ} |j sf|jj|jƒ} n|j j|jƒ} |j t |ƒt | ƒt |ƒt | ƒfƒ|| d7}|| d7}q`Wd dt |ƒ}|t |ƒ}g}g}xB|D]:\}}}}||||g7}||||g7}qW||}|jtjddd t |ƒddt |ƒd d d ƒtjd |ƒjƒ||ƒd S(s¶Write a catalog to the specified file-like object using the GNU MO file format. >>> from babel.messages import Catalog >>> from gettext import GNUTranslations >>> from StringIO import StringIO >>> catalog = Catalog(locale='en_US') >>> catalog.add('foo', 'Voh') >>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz')) >>> catalog.add('fuz', 'Futz', flags=['fuzzy']) >>> catalog.add('Fizz', '') >>> catalog.add(('Fuzz', 'Fuzzes'), ('', '')) >>> buf = StringIO() >>> write_mo(buf, catalog) >>> buf.seek(0) >>> translations = GNUTranslations(fp=buf) >>> translations.ugettext('foo') u'Voh' >>> translations.ungettext('bar', 'baz', 1) u'Bahr' >>> translations.ungettext('bar', 'baz', 2) u'Batz' >>> translations.ugettext('fuz') u'fuz' >>> translations.ugettext('Fizz') u'Fizz' >>> translations.ugettext('Fuzz') u'Fuzz' >>> translations.ugettext('Fuzzes') u'Fuzzes' :param fileobj: the file-like object to write to :param catalog: the `Catalog` instance :param use_fuzzy: whether translations marked as "fuzzy" should be included in the output ittiiitIiiiiiilÞ*iitiNiii(tlisttfuzzytsortt pluralizabletjointidtencodetcharsett enumeratetstringtappendtmintinttlentwritetstructtpacktarrayttostring(tfileobjtcatalogt use_fuzzytmessagestmtidststrstoffsetstmessagetmsgidtmsgstrstidxRtmsgstrtkeystartt valuestarttkoffsetstvoffsetsto1tl1to2tl2((s9/usr/lib/python2.7/site-packages/babel/messages/mofile.pyRsD' -    +&+ 1 (t__doc__RRt__all__t __docformat__tFalseR(((s9/usr/lib/python2.7/site-packages/babel/messages/mofile.pyts