+
    *:žga  ã                  ó¢   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ]'       d	   ^ RIHtHt RtR]R&   R	tR]R
&   R R ltRR R lltR# )zÉ
babel.messages.mofile
~~~~~~~~~~~~~~~~~~~~~

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

:copyright: (c) 2013-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
)ÚannotationsN)ÚTYPE_CHECKING)ÚCatalogÚMessage)ÚSupportsReadÚSupportsWritel   Þ* ÚintÚLE_MAGICl   •$< ÚBE_MAGICc               ó    € V ^8„  d   QhRRRR/# )é   ÚfileobjzSupportsRead[bytes]Úreturnr   © )Úformats   "Ú7/usr/lib/python3/dist-packages/babel/messages/mofile.pyÚ__annotate__r      s   € ÷ Oñ OÐ(ð O¨Wñ Oó    c                óÊ  € \        4       p/ p\        V RR4      pV P                  4       p\        V4      p\        P
                  pV! RVR,          4      ^ ,          pV\        8X  d   V! RVR,          4      w  r‰r«RpM.V\        8X  d   V! RVR,          4      w  r‰r«R	pM\        ^ R
V4      h\        V	4       EF	  pV! WÄWª^,            4      w  rïWþ,           pV! WÄW»^,            4      w  ppVV,           pVV8  d   VV8  d   WOV pVVV pM\        ^ RV4      hV^ 8X  d­   R;ppVP                  4        F”  pVP                  4       pV'       g   K  RV9   dK   VP                  R^4      w  ppVP                  4       P                  4       ;ppVP                  4       VV&   Kn  V'       g   Kx  VV;;,          RV,           ,          uu&   K–  	  RV9   d   VP                  R4      w  ppMRpRV9   dx   VP                  R4      pVP                  R4      pV Uu. uF  pVP                  VP                  4      NK   	  ppV Uu. uF  pVP                  VP                  4      NK   	  ppM6VP                  VP                  4      pVP                  VP                  4      p\!        VVVR7      VV&   V
^,          p
V^,          pEK  	  VP#                  4       Vn        V# u upi u upi )aI  Read 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.
ÚnameÚ z<I:Né   Nz<4I:r   é   Nz<IIz>4Iz>IIzBad magic numberzFile is corruptNó   :ó   
ó   ó    )Úcontext)r   ÚgetattrÚreadÚlenÚstructÚunpackr	   r
   ÚOSErrorÚrangeÚ
splitlinesÚstripÚsplitÚlowerÚdecodeÚcharsetr   ÚitemsÚmime_headers)r   ÚcatalogÚheadersÚfilenameÚbufÚbuflenr"   ÚmagicÚversionÚmsgcountÚorigidxÚtransidxÚiiÚ_iÚmlenÚmoffÚmendÚtlenÚtoffÚtendÚmsgÚtmsgÚlastkeyÚkeyÚitemÚvalueÚctxtÚxs   &                           r   Úread_morG      s¤  € ô ‹i€GØ€Gä�w ¨Ó+€Hà
�,‰,‹.€CÜ�‹X€FÜ�]‰]€Fñ �4˜˜R�Ó! !Õ$€EØ”ÔÙ/5°e¸SÀ½YÓ/GÑ,ˆ˜7Ø‰Ø	”(Ô	Ù/5°e¸SÀ½YÓ/GÑ,ˆ˜7Ø‰ä�aÐ+¨XÓ6Ð6ô �H�oˆÙ˜B G°a­KÐ 8Ó9‰
ˆØ�{ˆÙ˜B H¸­\Ð :Ó;‰
ˆˆdØ�d�{ˆØ�&Œ=˜T Fœ]Ø˜4�.ˆCØ�t˜D�>‰Dä˜!Ð.°Ó9Ð9ð �1Œ9à Ð ˆG�cØŸ™Ö)�Ø—z‘z“|�ßÙØ˜4”<Ø!%§¡¨D°!Ó!4‘J�C˜Ø$'§I¡I£K×$5Ñ$5Ó$7Ð7�G˜cØ#(§;¡;£=�G˜C“Lß‘WØ˜G×$¨°­Õ4Õ$ñ *ð �cŒ>ØŸ	™	 'Ó*‰IˆD‘#àˆDà�cŒ>Ø—)‘)˜GÓ$ˆCØ—:‘:˜gÓ&ˆDÙ69Ó:±c°�1—8‘8˜GŸO™OÖ,±cˆCÐ:Ù7;Ó<±t°!�A—H‘H˜WŸ_™_Ö-±tˆDÐ<ˆDà—*‘*˜WŸ_™_Ó-ˆCØ—;‘;˜wŸ™Ó/ˆDÜ˜s D°$Ô7ˆ�‰ð 	�1�ˆØ�A�‹ñW ðZ #Ÿ=™=›?€GÔØ€Nùò ;ùÚ<s   È$KÈ?$K c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r   zSupportsWrite[bytes]r-   r   Ú	use_fuzzyÚboolr   ÚNoner   )r   s   "r   r   r   k   s6   € ÷ g_ñ g_Ð*ð g_°Wð g_Èð g_ÐZ^ñ g_r   c                óä  € \        V4      pVR,           Uu. uF5  pVP                  '       g   K  V'       g   VP                  '       d   K3  VNK7  	  upVR&   VP                  4        R;rV. pV EFì  pVP                  '       dî   RP                  VP                   U	u. uF  q™P                  VP                  4      NK  	  up	4      p	. p
\        VP                  4       FU  w  r¼V'       g8   V
P                  VP                  \        \        V4      ^4      ,          4       KD  V
P                  V4       KW  	  RP                  V
 Uu. uF  qÝP                  VP                  4      NK  	  up4      pMJVP                  P                  VP                  4      p	VP                  P                  VP                  4      pVP                  '       d7   RP                  VP                  P                  VP                  4      V	.4      p	VP                  \        V4      \        V	4      \        V4      \        V4      34       WYR,           ,          pWmR,           ,          pEKï  	  ^^\        V4      ,          ,           pV\        V4      ,           p. p. pV F,  w  ppppVVVV,           .,          pVVVV,           .,          pK.  	  VV,           pV P                  \         P"                  ! R\$        ^ \        V4      ^^\        V4      ^,          ,           ^ ^ 4      \&        P&                  P)                  \&        P&                  ! RV4      4      ,           V,           V,           4       R# u upi u up	i u upi )a   Write 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
:é   NNr   r   r   ÚIiiiiiiÚiN)ÚlistÚstringÚfuzzyÚsortÚpluralizableÚjoinÚidÚencoder*   Ú	enumerateÚappendÚminr   r   r    Úwriter!   Úpackr	   ÚarrayÚtobytes)r   r-   rI   ÚmessagesÚmÚidsÚstrsÚoffsetsÚmessageÚmsgidÚmsgstrsÚidxrQ   ÚmsgstrÚkeystartÚ
valuestartÚkoffsetsÚvoffsetsÚo1Úl1Úo2Úl2s   &&&                   r   Úwrite_morq   k   sÐ  € ô` �G‹}€HØ'¨ž|ó @™|˜!Ø—x•xô ß%.°a·gµg÷ �A™|ñ @€HˆR�Là‡M�M„OàÐ€CØ€Gäˆð ××ÐØ—L‘LØ;B¿:º:ó"Ù;E°%—‘˜WŸ_™_Ö-¹:ñ"ó ˆEð ˆGÜ(¨¯©Ö8‘�ßØ—N‘N 7§:¡:¬c´#°c³(¸AÓ.>Õ#?Ö@à—N‘N 6Ö*ñ	  9ð
 —\‘\Ù=Dó#Ù=D°6—‘˜gŸo™oÖ.¹Wñ#ó ‰Fð —J‘J×%Ñ% g§o¡oÓ6ˆEØ—^‘^×*Ñ*¨7¯?©?Ó;ˆFØ�?�?ˆ?Ø—L‘L '§/¡/×"8Ñ"8¸¿¹Ó"IØ"'ð")ó *ˆEà�‰œ˜C›¤# e£*¬c°$«i¼¸V»ÐEÔFØ�w�ÕˆØ˜Õ Õ ‹ñ1 ð8 �rœC ›MÕ)Õ)€HØœC ›HÕ$€Jð €HØ€HÛ!‰ˆˆB��BØ�R˜˜h�Ð'Õ'ˆØ�R˜˜j�Ð)Õ)Šñ "ð ˜Õ!€Gà‡M�M”&—+’+˜iÜ&ØÜ! (›mØ#Ø#¤c¨(£m°aÕ&7Õ7Ø ó ô #(§+¡+×"5Ñ"5´e·k²kÀ#ÀwÓ6OÓ"PõQð TWõWð Z^õ^ö _ùò_@ùò"ùò#s!   —M#°M#¸M#ÁM#Â#M(
Å#M-
)F)Ú__conditional_annotations__Ú__doc__Ú
__future__r   r]   r!   Útypingr   Úbabel.messages.catalogr   r   Ú	_typeshedr   r   r	   Ú__annotations__r
   rG   rq   )rr   s   @r   Ú<module>ry      sK   øðôõ #ã Û Ý  ç 3çß5à€ˆ#Ó Ø€ˆ#Ó õO÷dg_ñ g_r   