Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/babel/messages/__pycache__/mofile.cpython-311.pyc



]jUdZddlmZddlZddlZddlmZddlmZm	Z	erddl
mZmZdZ
ded	<d
Zded<ddZdddZdS)z
    babel.messages.mofile
    ~~~~~~~~~~~~~~~~~~~~~

    Writing of files in the ``gettext`` MO (machine object) format.

    :copyright: (c) 2013-2023 by the Babel Team.
    :license: BSD, see LICENSE for more details.
)annotationsN)
TYPE_CHECKING)CatalogMessage)SupportsRead
SupportsWritel*intLE_MAGICl$<BE_MAGICfileobjSupportsRead[bytes]returnrcti}t|dd}|}t|}tj}|d|ddd}|tkr|d|dd\}}}	}
d	}n8|tkr|d
|dd\}}}	}
d}ntdd|t|D]}||||	|	d
z\}
}||
z}||||
|
d
z\}}||z}||kr||kr|||}|||}ntdd||
dkrdx}}|
D]}|}|sd|vrY|dd\}}|
x}}|||<v|r||xxd|zz
cc<d|vr|d\}}nd}d|vrN|d}|d}jrfd|D}fd|D}n;jr4|j}|j}t!||||<|	d
z
}	|
d
z
}
|_S)aaRead a binary MO file from the given file-like object and return a
    corresponding `Catalog` object.

    :param fileobj: the file-like object to read the MO file from

    :note: The implementation of this function is heavily based on the
           ``GNUTranslations._parse`` method of the ``gettext`` module in the
           standard library.
    namez<INrz<4Iz<IIz>4Iz>IIzBad magic numberzFile is corrupt:
cDg|]}|jSdecodecharset.0xcatalogs  u/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/babel/messages/mofile.py
<listcomp>zread_mo.<locals>.<listcomp>]s'>>>Qqxx00>>>cDg|]}|jSrrrs  r#r$zread_mo.<locals>.<listcomp>^s'@@@a11@@@r%)context)rgetattrreadlenstructunpackr
rOSErrorrange
splitlinesstripsplitlowerrrritemsmime_headers)rheadersfilenamebufbuflenr,magicversionmsgcountorigidxtransidxii_imlenmoffmendtlentofftendmsgtmsglastkeykeyitemvaluectxtr"s                          @r#read_morMsNiiGGw++H
,,..C
XXF
]F
F4RaR!!!$E/5veS2Y/G/G,7H
	(		/5veS2Y/G/G,7H
a+X666Hoo--VBGGaK$7 899
dd{VBHX\$9 :;;
dd{&==TF]]d4i.CtDy>DD!.999199  Gc))	
5	
5zz||4<<!%D!!4!4JC$'IIKK$5$5$7$77Gc#(;;==GCLL5G$$$4$$$c>>		'**ID##Dc>>))G$$C::g&&D
A>>>>#>>>@@@@4@@@
4jj11{{7?33sD$777	1A
"==??GNr%FSupportsWrite[bytes]r"	use_fuzzyboolNonec
|t}fd|ddD|dd<|dx}}g}|D]}|jrdfd|jD}g}	t|jD]X\}
}|s<|	|jtt|
dC|	|Ydfd|	D}n>|j
j}|j
j}|jr4d|j
j|g}|t|t|t|t|f||dzz
}||dzz
}d	d
t|zz}
|
t|z}g}g}|D]\}}}}||||
zgz
}||||zgz
}||z}|tjdt"dt|d	d	t|d
zzddt$jt%jd|z|z|zdS)aWrite a catalog to the specified file-like object using the GNU MO file
    format.

    >>> import sys
    >>> from babel.messages import Catalog
    >>> from gettext import GNUTranslations
    >>> from io import BytesIO

    >>> catalog = Catalog(locale='en_US')
    >>> catalog.add('foo', 'Voh')
    <Message ...>
    >>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz'))
    <Message ...>
    >>> catalog.add('fuz', 'Futz', flags=['fuzzy'])
    <Message ...>
    >>> catalog.add('Fizz', '')
    <Message ...>
    >>> catalog.add(('Fuzz', 'Fuzzes'), ('', ''))
    <Message ...>
    >>> buf = BytesIO()

    >>> write_mo(buf, catalog)
    >>> x = buf.seek(0)
    >>> translations = GNUTranslations(fp=buf)
    >>> if sys.version_info[0] >= 3:
    ...     translations.ugettext = translations.gettext
    ...     translations.ungettext = translations.ngettext
    >>> 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
    c4g|]}|j	s|j|Sr)stringfuzzy)r mrOs  r#r$zwrite_mo.<locals>.<listcomp>sJ@@@!x@%.@67g@A@@@r%rNr%rcDg|]}|jSrencoder)r msgidr"s  r#r$zwrite_mo.<locals>.<listcomp>s4"""27W_--"""r%cDg|]}|jSrrX)r msgstrr"s  r#r$zwrite_mo.<locals>.<listcomp>s4###39

go..###r%rIiiiiiirri)listsortpluralizablejoinid	enumeraterTappendminr	rYrr'r*writer+packr
arraytobytes)rr"rOmessagesidsstrsoffsetsmessagerZmsgstrsidxrTr\keystart
valuestartkoffsetsvoffsetso1l1o2l2s ``                  r#write_mor|msB`G}}H@@@@x|@@@HQRRLMMOOOC$G!!	<LL"""";B:"""EG(88
+
+V+NN7:c#c((A.>.>#?@@@@NN6****\\####=D###FFJ%%go66E^**7?;;F?	*LL'/"8"8"I"I"'")**EC#e**c$iiVEFFFuw  rCMM))HCHH$JHH!**BBRh''Rj))!GMM&+i&!(mm##c(mma&77
  #(+"5"5ek#w6O6O"P"PQTWWZ^^_____r%)rr
rr)F)rrNr"rrOrPrrQ)__doc__
__future__rrkr+typingrbabel.messages.catalogrr	_typeshedrrr
__annotations__rrMr|rr%r#<module>rs#"""""



      33333333655555555QQQQhg_g_g_g_g_g_g_r%
Back to Directory File Manager