Ë
    ÆªbÎ  ã                   ó>   — d Z ddlZddlZddlmZmZ dZdZd„ Zdd„Z	y)	zÝ
    babel.messages.mofile
    ~~~~~~~~~~~~~~~~~~~~~

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

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
é    N)ÚCatalogÚMessagel   Þ* l   •$< c                 óV  — t        «       }i }t        | dd«      }| j                  «       }t        |«      }t        j
                  } |d|dd «      d   }|t        k(  r |d|dd «      \  }}	}
}d	}n*|t        k(  r |d
|dd «      \  }}	}
}d}nt        dd|«      ‚t        d|	«      D �]ß  } ||||
|
dz    «      \  }}||z   } |||||dz    «      \  }}||z   }||k  r||k  r||| }||| }nt        dd|«      ‚|dk(  rŒdx}}|j                  «       D ]u  }|j                  «       }|sŒd|v rI|j                  dd«      \  }}|j                  «       j                  «       x}}|j                  «       ||<   Œc|sŒf||xx   d|z   z  cc<   Œw d|v r|j                  d«      \  }}nd}d|v r|j                  d«      }|j                  d«      }|j                  r“|D �cg c]  }|j                  |j                  «      ‘Œ }}|D �cg c]  }|j                  |j                  «      ‘Œ }}nB|j                  r6|j                  |j                  «      }|j                  |j                  «      }t!        |||¬«      ||<   |
dz  }
|dz  }�Œâ |j#                  «       |_        |S c c}w c c}w )aa  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<INé   r   z<4Ié   z<IIz>4Iz>IIzBad magic numberé   zFile is corruptó   :é   ó   
ó   ó    )Úcontext)r   ÚgetattrÚreadÚlenÚstructÚunpackÚLE_MAGICÚBE_MAGICÚOSErrorÚrangeÚ
splitlinesÚstripÚsplitÚlowerÚcharsetÚdecoder   ÚitemsÚmime_headers)ÚfileobjÚ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                               ú7/usr/lib/python3/dist-packages/babel/messages/mofile.pyÚread_mor>      sÕ  € ô ‹i€GØ€Gä�w ¨Ó+€Hà
�,‰,‹.€CÜ�‹X€FÜ�]‰]€Fñ �4˜˜R˜a˜Ó! !Ñ$€EØ”ÒÙ/5°e¸SÀÀ2¸YÓ/GÑ,ˆ�˜7 HØ‰Ø	”(Ò	Ù/5°e¸SÀÀ2¸YÓ/GÑ,ˆ�˜7 HØ‰ä�aÐ+¨XÓ6Ð6ô �1�hÓó -ˆÙ˜B  G¨G°a©KÐ 8Ó9‰
ˆˆdØ�d‰{ˆÙ˜B  H¨X¸©\Ð :Ó;‰
ˆˆdØ�d‰{ˆØ�&Š=˜T Fš]Ø�d˜4�.ˆCØ�t˜D�>‰Dä˜!Ð.°Ó9Ð9ð �1Š9à Ð ˆG�cØŸ™Ó)ò 	5�Ø—z‘z“|�ÙØØ˜4‘<Ø!%§¡¨D°!Ó!4‘J�C˜Ø$'§I¡I£K×$5Ñ$5Ó$7Ð7�G˜cØ#(§;¡;£=�G˜C’LÚØ˜GÓ$¨°©Ñ4Ô$ð	5ð �c‰>ØŸ	™	 'Ó*‰IˆD‘#àˆDà�c‰>Ø—)‘)˜GÓ$ˆCØ—:‘:˜gÓ&ˆDØ�ŠØ:=Ö>°Q�q—x‘x §¡Õ0Ð>�Ð>Ø;?Ö@°a˜Ÿ™ §¡Õ1Ð@�Ñ@à�ŠØ—j‘j §¡Ó1�Ø—{‘{ 7§?¡?Ó3�Ü˜s D°$Ô7ˆ�‰ð 	�1‰ˆØ�A‰Šð[-ð^ #Ÿ=™=›?€GÔØ€Nùò ?ùÚ@s   Ç"J!È"J&c                 óè  — t        |«      }|dd D �cg c]  }|j                  r|s|j                  s|‘Œ  c}|dd |j                  «        dx}}g }|D �]Ã  }|j                  rßdj                  |j                  D �	cg c]  }	|	j                  |j                  «      ‘Œ c}	«      }	g }
t        |j                  «      D ]J  \  }}|s2|
j                  |j                  t        t        |«      d«         «       Œ:|
j                  |«       ŒL dj                  |
D �cg c]  }|j                  |j                  «      ‘Œ c}«      }nJ|j                  j                  |j                  «      }	|j                  j                  |j                  «      }|j                  r6dj                  |j                  j                  |j                  «      |	g«      }	|j                  t        |«      t        |	«      t        |«      t        |«      f«       ||	dz   z  }||dz   z  }�ŒÆ ddt        |«      z  z   }|t        |«      z   }g }g }|D ]  \  }}}}||||z   gz  }||||z   gz  }Œ ||z   }| j                  t!        j"                  dt$        d	t        |«      ddt        |«      d
z  z   d	d	«      t&        j&                  j)                  t'        j&                  d|«      «      z   |z   |z   «       yc c}w c c}	w c c}w )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
    r   Nó    r   r   é   é   ÚIiiiiiir   r
   r.   )ÚlistÚstringÚfuzzyÚsortÚpluralizableÚjoinÚidÚencoder   Ú	enumerateÚappendÚminÚintr   r   Úwriter   Úpackr   ÚarrayÚtobytes)r"   r#   Ú	use_fuzzyÚmessagesÚmÚidsÚstrsÚoffsetsÚmessageÚmsgidÚmsgstrsÚidxrE   ÚmsgstrÚkeystartÚ
valuestartÚkoffsetsÚvoffsetsÚo1Úl1Úo2Úl2s                         r=   Úwrite_morg   i   sÖ  € ô` �G‹}€HØ'¨¨˜|ö @˜!Ø—x’x¡Y°a·g²gò ò @€HˆQˆR€Là‡M�M„OàÐ€Cˆ$Ø€Gàó !ˆð ×ÒØ—L‘LØ;B¿:¹:ö"Ø27�—‘˜WŸ_™_Õ-ò"ó ˆEð ˆGÜ(¨¯©Ó8ò +‘��VÙØ—N‘N 7§:¡:¬c´#°c³(¸AÓ.>Ñ#?Õ@à—N‘N 6Õ*ð	+ð
 —\‘\Ø=Dö#Ø39�—‘˜gŸo™oÕ.ò#ó ‰Fð —J‘J×%Ñ% g§o¡oÓ6ˆEØ—^‘^×*Ñ*¨7¯?©?Ó;ˆFØ�?Š?Ø—L‘L '§/¡/×"8Ñ"8¸¿¹Ó"IØ"'ð")ó *ˆEà�‰œ˜C›¤# e£*¬c°$«i¼¸V»ÐEÔFØˆu�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   “#K%Á="K*
Ä"K/
)F)
Ú__doc__rR   r   Úbabel.messages.catalogr   r   r   r   r>   rg   © r@   r=   ú<module>rk      s/   ðñó Û ç 3ð €Ø€òQôhg_r@   