0
     ˆÄÃÊ379ÂÈÇ {    ‹      •’ËNÃ0E÷|Åà»f@”uŒ ©D¥¾T‚B,ÜØI,Ò8r†–òõ$u ñ+?æÜñÜóÃx%÷ó!\'“1Ìo¯Æ£Xñî4BŒ“ØúÁñ	âpÊ€Dõ9âf³	6§�u9&,hUö±!gR
)&xw'€ZªvN†J-F•Ò/`3@ûL�Qº�J¯q�ËÑ#­÷*¾´jÛ%;ù]ØÆwOÈåNßm�àTÀZ–&¯BF¶f‚›U�KC†&µUƒËRVOAn2²¤�=Œ¢ÙcË!�Zp	…ÓYÈ.¢p:˜…—LLåJs”ß3ÏŒeC°²ÊdF«áß˜×ŸÆž‰u“:S“±ÕŠ­ÅÏVS[6µl½žµ
÷™òˆú«2ýÒŒùåb8MâÑÂ·Du)>ªû:&æÒéŠ 6N§dÝv_¨WUË¦¼a_†3yAL ôà[ò?q?{Ž»/ÃÑÿ¿7ðTÞ‰â        ˆ¾‘äÇò 8à_Ú u‘ÿ?Ëƒh¹ÊÈÇ      0
  L   ˆl–Ðz¾”d
i?u8 \¸Ó× 1hß�þB gÁJ0?Ìƒh¹Ëa–ßi~” T¾R( 	Å+‚rãl©‹FÿÉ      tty0 ttyS0
      ˆÈ�þZh%Y¹DGÃ Â�ÏÍ„­2÷ÌÇ¾É ?÷     # Copyright (C) 2005-2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

"""XML externalization support."""

# "XML is like violence: if it doesn't solve your problem, you aren't
# using enough of it." -- various

# importing this module is fairly slow because it has to load several
# ElementTree bits

import re
from typing import Dict, Union

from xml.etree.ElementTree import (
    ElementTree, SubElement, Element,
    fromstringlist, tostringlist, tostring,
    fromstring, ParseError)

from .. import (
    errors,
    lazy_regex,
    )
from . import (
    inventory,
    serializer,
    )


class XMLSerializer(serializer.Serializer):
    """Abstract XML object serialize/deserialize"""

    squashes_xml_invalid_characters = True

    def read_inventory_from_lines(self, lines, revision_id=None,
                                  entry_cache=None, return_from_cache=False):
        """Read xml_string into an inventory object.

        :param chunks: The xml to read.
        :param revision_id: If not-None, the expected revision id of the
            inventory. Some serialisers use this to set the results' root
            revision. This should be supplied for deserialising all
            from-repository inventories so that xml5 inventories that were
            serialised without a revision identifier can be given the right
            revision id (but not for working tree inventories where users can
            edit the data without triggering checksum errors or anything).
        :param entry_cache: An optional cache of InventoryEntry objects. If
            supplied we will look up entries via (file_id, revision_id) which
            should map to a valid InventoryEntry (File/Directory/etc) object.
        :param return_from_cache: Return entries directly from the cache,
            rather than copying them first. This is only safe if the caller
            promises not to mutate the returned inventory entries, but it can
            make some operations significantly faster.
        """
        try:
            return self._unpack_inventory(fromstringlist(lines), revision_id,
                                          entry_cache=entry_cache,
                                          return_from_cache=return_from_cache)
        except ParseError as e:
            raise serializer.UnexpectedInventoryFormat(str(e))

    def read_inventory(self, f, revision_id=None):
        try:
            try:
                return self._unpack_inventory(self._read_element(f),
                                              revision_id=None)
            finally:
                f.close()
        except ParseError as e:
            raise serializer.UnexpectedInventoryFormat(str(e))

    def write_revision_to_string(self, rev):
        return b''.join(self.write_revision_to