Current File : /home/mmdealscpanel/yummmdeals.com/sax.tar
_exceptions.py000064400000011261150346007760007447 0ustar00"""Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
    from java.lang import Exception
del sys

# ===== SAXEXCEPTION =====

class SAXException(Exception):
    """Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it."""

    def __init__(self, msg, exception=None):
        """Creates an exception. The message is required, but the exception
        is optional."""
        self._msg = msg
        self._exception = exception
        Exception.__init__(self, msg)

    def getMessage(self):
        "Return a message for this exception."
        return self._msg

    def getException(self):
        "Return the embedded exception, or None if there was none."
        return self._exception

    def __str__(self):
        "Create a string representation of the exception."
        return self._msg

    def __getitem__(self, ix):
        """Avoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined."""
        raise AttributeError("__getitem__")


# ===== SAXPARSEEXCEPTION =====

class SAXParseException(SAXException):
    """Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception."""

    def __init__(self, msg, exception, locator):
        "Creates the exception. The exception parameter is allowed to be None."
        SAXException.__init__(self, msg, exception)
        self._locator = locator

        # We need to cache this stuff at construction time.
        # If this exception is raised, the objects through which we must
        # traverse to get this information may be deleted by the time
        # it gets caught.
        self._systemId = self._locator.getSystemId()
        self._colnum = self._locator.getColumnNumber()
        self._linenum = self._locator.getLineNumber()

    def getColumnNumber(self):
        """The column number of the end of the text where the exception
        occurred."""
        return self._colnum

    def getLineNumber(self):
        "The line number of the end of the text where the exception occurred."
        return self._linenum

    def getPublicId(self):
        "Get the public identifier of the entity where the exception occurred."
        return self._locator.getPublicId()

    def getSystemId(self):
        "Get the system identifier of the entity where the exception occurred."
        return self._systemId

    def __str__(self):
        "Create a string representation of the exception."
        sysid = self.getSystemId()
        if sysid is None:
            sysid = "<unknown>"
        linenum = self.getLineNumber()
        if linenum is None:
            linenum = "?"
        colnum = self.getColumnNumber()
        if colnum is None:
            colnum = "?"
        return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg)


# ===== SAXNOTRECOGNIZEDEXCEPTION =====

class SAXNotRecognizedException(SAXException):
    """Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes."""


# ===== SAXNOTSUPPORTEDEXCEPTION =====

class SAXNotSupportedException(SAXException):
    """Exception class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes."""

# ===== SAXNOTSUPPORTEDEXCEPTION =====

class SAXReaderNotAvailable(SAXNotSupportedException):
    """Exception class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted."""
__init__.py000064400000007077150346007760006700 0ustar00"""Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
"""

from .xmlreader import InputSource
from .handler import ContentHandler, ErrorHandler
from ._exceptions import SAXException, SAXNotRecognizedException, \
                        SAXParseException, SAXNotSupportedException, \
                        SAXReaderNotAvailable


def parse(source, handler, errorHandler=ErrorHandler()):
    parser = make_parser()
    parser.setContentHandler(handler)
    parser.setErrorHandler(errorHandler)
    parser.parse(source)

def parseString(string, handler, errorHandler=ErrorHandler()):
    import io
    if errorHandler is None:
        errorHandler = ErrorHandler()
    parser = make_parser()
    parser.setContentHandler(handler)
    parser.setErrorHandler(errorHandler)

    inpsrc = InputSource()
    if isinstance(string, str):
        inpsrc.setCharacterStream(io.StringIO(string))
    else:
        inpsrc.setByteStream(io.BytesIO(string))
    parser.parse(inpsrc)

# this is the parser list used by the make_parser function if no
# alternatives are given as parameters to the function

default_parser_list = ["xml.sax.expatreader"]

# tell modulefinder that importing sax potentially imports expatreader
_false = 0
if _false:
    import xml.sax.expatreader

import os, sys
if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ:
    default_parser_list = os.environ["PY_SAX_PARSER"].split(",")
del os

_key = "python.xml.sax.parser"
if sys.platform[:4] == "java" and sys.registry.containsKey(_key):
    default_parser_list = sys.registry.getProperty(_key).split(",")


def make_parser(parser_list=()):
    """Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the iterable created by chaining parser_list and
    default_parser_list.  The iterables must contain the names of Python
    modules containing both a SAX parser and a create_parser function."""

    for parser_name in list(parser_list) + default_parser_list:
        try:
            return _create_parser(parser_name)
        except ImportError as e:
            import sys
            if parser_name in sys.modules:
                # The parser module was found, but importing it
                # failed unexpectedly, pass this exception through
                raise
        except SAXReaderNotAvailable:
            # The parser module detected that it won't work properly,
            # so try the next one
            pass

    raise SAXReaderNotAvailable("No parsers found", None)

# --- Internal utility methods used by make_parser

if sys.platform[ : 4] == "java":
    def _create_parser(parser_name):
        from org.python.core import imp
        drv_module = imp.importName(parser_name, 0, globals())
        return drv_module.create_parser()

else:
    def _create_parser(parser_name):
        drv_module = __import__(parser_name,{},{},['create_parser'])
        return drv_module.create_parser()

del sys
saxutils.py000064400000027737150346007760007022 0ustar00"""\
A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""

import os, urllib.parse, urllib.request
import io
import codecs
from . import handler
from . import xmlreader

def __dict_replace(s, d):
    """Replace substrings of a string using a dictionary."""
    for key, value in d.items():
        s = s.replace(key, value)
    return s

def escape(data, entities={}):
    """Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    """

    # must do ampersand first
    data = data.replace("&", "&amp;")
    data = data.replace(">", "&gt;")
    data = data.replace("<", "&lt;")
    if entities:
        data = __dict_replace(data, entities)
    return data

def unescape(data, entities={}):
    """Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    """
    data = data.replace("&lt;", "<")
    data = data.replace("&gt;", ">")
    if entities:
        data = __dict_replace(data, entities)
    # must do ampersand last
    return data.replace("&amp;", "&")

def quoteattr(data, entities={}):
    """Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The \" character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    """
    entities = {**entities, '\n': '&#10;', '\r': '&#13;', '\t':'&#9;'}
    data = escape(data, entities)
    if '"' in data:
        if "'" in data:
            data = '"%s"' % data.replace('"', "&quot;")
        else:
            data = "'%s'" % data
    else:
        data = '"%s"' % data
    return data


def _gettextwriter(out, encoding):
    if out is None:
        import sys
        return sys.stdout

    if isinstance(out, io.TextIOBase):
        # use a text writer as is
        return out

    if isinstance(out, (codecs.StreamWriter, codecs.StreamReaderWriter)):
        # use a codecs stream writer as is
        return out

    # wrap a binary writer with TextIOWrapper
    if isinstance(out, io.RawIOBase):
        # Keep the original file open when the TextIOWrapper is
        # destroyed
        class _wrapper:
            __class__ = out.__class__
            def __getattr__(self, name):
                return getattr(out, name)
        buffer = _wrapper()
        buffer.close = lambda: None
    else:
        # This is to handle passed objects that aren't in the
        # IOBase hierarchy, but just have a write method
        buffer = io.BufferedIOBase()
        buffer.writable = lambda: True
        buffer.write = out.write
        try:
            # TextIOWrapper uses this methods to determine
            # if BOM (for UTF-16, etc) should be added
            buffer.seekable = out.seekable
            buffer.tell = out.tell
        except AttributeError:
            pass
    return io.TextIOWrapper(buffer, encoding=encoding,
                            errors='xmlcharrefreplace',
                            newline='\n',
                            write_through=True)

class XMLGenerator(handler.ContentHandler):

    def __init__(self, out=None, encoding="iso-8859-1", short_empty_elements=False):
        handler.ContentHandler.__init__(self)
        out = _gettextwriter(out, encoding)
        self._write = out.write
        self._flush = out.flush
        self._ns_contexts = [{}] # contains uri -> prefix dicts
        self._current_context = self._ns_contexts[-1]
        self._undeclared_ns_maps = []
        self._encoding = encoding
        self._short_empty_elements = short_empty_elements
        self._pending_start_element = False

    def _qname(self, name):
        """Builds a qualified name from a (ns_url, localname) pair"""
        if name[0]:
            # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is
            # bound by definition to http://www.w3.org/XML/1998/namespace.  It
            # does not need to be declared and will not usually be found in
            # self._current_context.
            if 'http://www.w3.org/XML/1998/namespace' == name[0]:
                return 'xml:' + name[1]
            # The name is in a non-empty namespace
            prefix = self._current_context[name[0]]
            if prefix:
                # If it is not the default namespace, prepend the prefix
                return prefix + ":" + name[1]
        # Return the unqualified name
        return name[1]

    def _finish_pending_start_element(self,endElement=False):
        if self._pending_start_element:
            self._write('>')
            self._pending_start_element = False

    # ContentHandler methods

    def startDocument(self):
        self._write('<?xml version="1.0" encoding="%s"?>\n' %
                        self._encoding)

    def endDocument(self):
        self._flush()

    def startPrefixMapping(self, prefix, uri):
        self._ns_contexts.append(self._current_context.copy())
        self._current_context[uri] = prefix
        self._undeclared_ns_maps.append((prefix, uri))

    def endPrefixMapping(self, prefix):
        self._current_context = self._ns_contexts[-1]
        del self._ns_contexts[-1]

    def startElement(self, name, attrs):
        self._finish_pending_start_element()
        self._write('<' + name)
        for (name, value) in attrs.items():
            self._write(' %s=%s' % (name, quoteattr(value)))
        if self._short_empty_elements:
            self._pending_start_element = True
        else:
            self._write(">")

    def endElement(self, name):
        if self._pending_start_element:
            self._write('/>')
            self._pending_start_element = False
        else:
            self._write('</%s>' % name)

    def startElementNS(self, name, qname, attrs):
        self._finish_pending_start_element()
        self._write('<' + self._qname(name))

        for prefix, uri in self._undeclared_ns_maps:
            if prefix:
                self._write(' xmlns:%s="%s"' % (prefix, uri))
            else:
                self._write(' xmlns="%s"' % uri)
        self._undeclared_ns_maps = []

        for (name, value) in attrs.items():
            self._write(' %s=%s' % (self._qname(name), quoteattr(value)))
        if self._short_empty_elements:
            self._pending_start_element = True
        else:
            self._write(">")

    def endElementNS(self, name, qname):
        if self._pending_start_element:
            self._write('/>')
            self._pending_start_element = False
        else:
            self._write('</%s>' % self._qname(name))

    def characters(self, content):
        if content:
            self._finish_pending_start_element()
            if not isinstance(content, str):
                content = str(content, self._encoding)
            self._write(escape(content))

    def ignorableWhitespace(self, content):
        if content:
            self._finish_pending_start_element()
            if not isinstance(content, str):
                content = str(content, self._encoding)
            self._write(content)

    def processingInstruction(self, target, data):
        self._finish_pending_start_element()
        self._write('<?%s %s?>' % (target, data))


class XMLFilterBase(xmlreader.XMLReader):
    """This class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through."""

    def __init__(self, parent = None):
        xmlreader.XMLReader.__init__(self)
        self._parent = parent

    # ErrorHandler methods

    def error(self, exception):
        self._err_handler.error(exception)

    def fatalError(self, exception):
        self._err_handler.fatalError(exception)

    def warning(self, exception):
        self._err_handler.warning(exception)

    # ContentHandler methods

    def setDocumentLocator(self, locator):
        self._cont_handler.setDocumentLocator(locator)

    def startDocument(self):
        self._cont_handler.startDocument()

    def endDocument(self):
        self._cont_handler.endDocument()

    def startPrefixMapping(self, prefix, uri):
        self._cont_handler.startPrefixMapping(prefix, uri)

    def endPrefixMapping(self, prefix):
        self._cont_handler.endPrefixMapping(prefix)

    def startElement(self, name, attrs):
        self._cont_handler.startElement(name, attrs)

    def endElement(self, name):
        self._cont_handler.endElement(name)

    def startElementNS(self, name, qname, attrs):
        self._cont_handler.startElementNS(name, qname, attrs)

    def endElementNS(self, name, qname):
        self._cont_handler.endElementNS(name, qname)

    def characters(self, content):
        self._cont_handler.characters(content)

    def ignorableWhitespace(self, chars):
        self._cont_handler.ignorableWhitespace(chars)

    def processingInstruction(self, target, data):
        self._cont_handler.processingInstruction(target, data)

    def skippedEntity(self, name):
        self._cont_handler.skippedEntity(name)

    # DTDHandler methods

    def notationDecl(self, name, publicId, systemId):
        self._dtd_handler.notationDecl(name, publicId, systemId)

    def unparsedEntityDecl(self, name, publicId, systemId, ndata):
        self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata)

    # EntityResolver methods

    def resolveEntity(self, publicId, systemId):
        return self._ent_handler.resolveEntity(publicId, systemId)

    # XMLReader methods

    def parse(self, source):
        self._parent.setContentHandler(self)
        self._parent.setErrorHandler(self)
        self._parent.setEntityResolver(self)
        self._parent.setDTDHandler(self)
        self._parent.parse(source)

    def setLocale(self, locale):
        self._parent.setLocale(locale)

    def getFeature(self, name):
        return self._parent.getFeature(name)

    def setFeature(self, name, state):
        self._parent.setFeature(name, state)

    def getProperty(self, name):
        return self._parent.getProperty(name)

    def setProperty(self, name, value):
        self._parent.setProperty(name, value)

    # XMLFilter methods

    def getParent(self):
        return self._parent

    def setParent(self, parent):
        self._parent = parent

# --- Utility functions

def prepare_input_source(source, base=""):
    """This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading."""

    if isinstance(source, os.PathLike):
        source = os.fspath(source)
    if isinstance(source, str):
        source = xmlreader.InputSource(source)
    elif hasattr(source, "read"):
        f = source
        source = xmlreader.InputSource()
        if isinstance(f.read(0), str):
            source.setCharacterStream(f)
        else:
            source.setByteStream(f)
        if hasattr(f, "name") and isinstance(f.name, str):
            source.setSystemId(f.name)

    if source.getCharacterStream() is None and source.getByteStream() is None:
        sysid = source.getSystemId()
        basehead = os.path.dirname(os.path.normpath(base))
        sysidfilename = os.path.join(basehead, sysid)
        if os.path.isfile(sysidfilename):
            source.setSystemId(sysidfilename)
            f = open(sysidfilename, "rb")
        else:
            source.setSystemId(urllib.parse.urljoin(base, sysid))
            f = urllib.request.urlopen(source.getSystemId())

        source.setByteStream(f)

    return source
expatreader.py000064400000036530150346007760007441 0ustar00"""
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
"""

version = "0.20"

from xml.sax._exceptions import *
from xml.sax.handler import feature_validation, feature_namespaces
from xml.sax.handler import feature_namespace_prefixes
from xml.sax.handler import feature_external_ges, feature_external_pes
from xml.sax.handler import feature_string_interning
from xml.sax.handler import property_xml_string, property_interning_dict

# xml.parsers.expat does not raise ImportError in Jython
import sys
if sys.platform[:4] == "java":
    raise SAXReaderNotAvailable("expat not available in Java", None)
del sys

try:
    from xml.parsers import expat
except ImportError:
    raise SAXReaderNotAvailable("expat not supported", None)
else:
    if not hasattr(expat, "ParserCreate"):
        raise SAXReaderNotAvailable("expat not supported", None)
from xml.sax import xmlreader, saxutils, handler

AttributesImpl = xmlreader.AttributesImpl
AttributesNSImpl = xmlreader.AttributesNSImpl

# If we're using a sufficiently recent version of Python, we can use
# weak references to avoid cycles between the parser and content
# handler, otherwise we'll just have to pretend.
try:
    import _weakref
except ImportError:
    def _mkproxy(o):
        return o
else:
    import weakref
    _mkproxy = weakref.proxy
    del weakref, _weakref

class _ClosedParser:
    pass

# --- ExpatLocator

class ExpatLocator(xmlreader.Locator):
    """Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    """
    def __init__(self, parser):
        self._ref = _mkproxy(parser)

    def getColumnNumber(self):
        parser = self._ref
        if parser._parser is None:
            return None
        return parser._parser.ErrorColumnNumber

    def getLineNumber(self):
        parser = self._ref
        if parser._parser is None:
            return 1
        return parser._parser.ErrorLineNumber

    def getPublicId(self):
        parser = self._ref
        if parser is None:
            return None
        return parser._source.getPublicId()

    def getSystemId(self):
        parser = self._ref
        if parser is None:
            return None
        return parser._source.getSystemId()


# --- ExpatParser

class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
    """SAX driver for the pyexpat C module."""

    def __init__(self, namespaceHandling=0, bufsize=2**16-20):
        xmlreader.IncrementalParser.__init__(self, bufsize)
        self._source = xmlreader.InputSource()
        self._parser = None
        self._namespaces = namespaceHandling
        self._lex_handler_prop = None
        self._parsing = 0
        self._entity_stack = []
        self._external_ges = 0
        self._interning = None

    # XMLReader methods

    def parse(self, source):
        "Parse an XML document from a URL or an InputSource."
        source = saxutils.prepare_input_source(source)

        self._source = source
        try:
            self.reset()
            self._cont_handler.setDocumentLocator(ExpatLocator(self))
            xmlreader.IncrementalParser.parse(self, source)
        except:
            # bpo-30264: Close the source on error to not leak resources:
            # xml.sax.parse() doesn't give access to the underlying parser
            # to the caller
            self._close_source()
            raise

    def prepareParser(self, source):
        if source.getSystemId() is not None:
            self._parser.SetBase(source.getSystemId())

    # Redefined setContentHandler to allow changing handlers during parsing

    def setContentHandler(self, handler):
        xmlreader.IncrementalParser.setContentHandler(self, handler)
        if self._parsing:
            self._reset_cont_handler()

    def getFeature(self, name):
        if name == feature_namespaces:
            return self._namespaces
        elif name == feature_string_interning:
            return self._interning is not None
        elif name in (feature_validation, feature_external_pes,
                      feature_namespace_prefixes):
            return 0
        elif name == feature_external_ges:
            return self._external_ges
        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)

    def setFeature(self, name, state):
        if self._parsing:
            raise SAXNotSupportedException("Cannot set features while parsing")

        if name == feature_namespaces:
            self._namespaces = state
        elif name == feature_external_ges:
            self._external_ges = state
        elif name == feature_string_interning:
            if state:
                if self._interning is None:
                    self._interning = {}
            else:
                self._interning = None
        elif name == feature_validation:
            if state:
                raise SAXNotSupportedException(
                    "expat does not support validation")
        elif name == feature_external_pes:
            if state:
                raise SAXNotSupportedException(
                    "expat does not read external parameter entities")
        elif name == feature_namespace_prefixes:
            if state:
                raise SAXNotSupportedException(
                    "expat does not report namespace prefixes")
        else:
            raise SAXNotRecognizedException(
                "Feature '%s' not recognized" % name)

    def getProperty(self, name):
        if name == handler.property_lexical_handler:
            return self._lex_handler_prop
        elif name == property_interning_dict:
            return self._interning
        elif name == property_xml_string:
            if self._parser:
                if hasattr(self._parser, "GetInputContext"):
                    return self._parser.GetInputContext()
                else:
                    raise SAXNotRecognizedException(
                        "This version of expat does not support getting"
                        " the XML string")
            else:
                raise SAXNotSupportedException(
                    "XML string cannot be returned when not parsing")
        raise SAXNotRecognizedException("Property '%s' not recognized" % name)

    def setProperty(self, name, value):
        if name == handler.property_lexical_handler:
            self._lex_handler_prop = value
            if self._parsing:
                self._reset_lex_handler_prop()
        elif name == property_interning_dict:
            self._interning = value
        elif name == property_xml_string:
            raise SAXNotSupportedException("Property '%s' cannot be set" %
                                           name)
        else:
            raise SAXNotRecognizedException("Property '%s' not recognized" %
                                            name)

    # IncrementalParser methods

    def feed(self, data, isFinal = 0):
        if not self._parsing:
            self.reset()
            self._parsing = 1
            self._cont_handler.startDocument()

        try:
            # The isFinal parameter is internal to the expat reader.
            # If it is set to true, expat will check validity of the entire
            # document. When feeding chunks, they are not normally final -
            # except when invoked from close.
            self._parser.Parse(data, isFinal)
        except expat.error as e:
            exc = SAXParseException(expat.ErrorString(e.code), e, self)
            # FIXME: when to invoke error()?
            self._err_handler.fatalError(exc)

    def _close_source(self):
        source = self._source
        try:
            file = source.getCharacterStream()
            if file is not None:
                file.close()
        finally:
            file = source.getByteStream()
            if file is not None:
                file.close()

    def close(self):
        if (self._entity_stack or self._parser is None or
            isinstance(self._parser, _ClosedParser)):
            # If we are completing an external entity, do nothing here
            return
        try:
            self.feed("", isFinal = 1)
            self._cont_handler.endDocument()
            self._parsing = 0
            # break cycle created by expat handlers pointing to our methods
            self._parser = None
        finally:
            self._parsing = 0
            if self._parser is not None:
                # Keep ErrorColumnNumber and ErrorLineNumber after closing.
                parser = _ClosedParser()
                parser.ErrorColumnNumber = self._parser.ErrorColumnNumber
                parser.ErrorLineNumber = self._parser.ErrorLineNumber
                self._parser = parser
            self._close_source()

    def _reset_cont_handler(self):
        self._parser.ProcessingInstructionHandler = \
                                    self._cont_handler.processingInstruction
        self._parser.CharacterDataHandler = self._cont_handler.characters

    def _reset_lex_handler_prop(self):
        lex = self._lex_handler_prop
        parser = self._parser
        if lex is None:
            parser.CommentHandler = None
            parser.StartCdataSectionHandler = None
            parser.EndCdataSectionHandler = None
            parser.StartDoctypeDeclHandler = None
            parser.EndDoctypeDeclHandler = None
        else:
            parser.CommentHandler = lex.comment
            parser.StartCdataSectionHandler = lex.startCDATA
            parser.EndCdataSectionHandler = lex.endCDATA
            parser.StartDoctypeDeclHandler = self.start_doctype_decl
            parser.EndDoctypeDeclHandler = lex.endDTD

    def reset(self):
        if self._namespaces:
            self._parser = expat.ParserCreate(self._source.getEncoding(), " ",
                                              intern=self._interning)
            self._parser.namespace_prefixes = 1
            self._parser.StartElementHandler = self.start_element_ns
            self._parser.EndElementHandler = self.end_element_ns
        else:
            self._parser = expat.ParserCreate(self._source.getEncoding(),
                                              intern = self._interning)
            self._parser.StartElementHandler = self.start_element
            self._parser.EndElementHandler = self.end_element

        self._reset_cont_handler()
        self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl
        self._parser.NotationDeclHandler = self.notation_decl
        self._parser.StartNamespaceDeclHandler = self.start_namespace_decl
        self._parser.EndNamespaceDeclHandler = self.end_namespace_decl

        self._decl_handler_prop = None
        if self._lex_handler_prop:
            self._reset_lex_handler_prop()
#         self._parser.DefaultHandler =
#         self._parser.DefaultHandlerExpand =
#         self._parser.NotStandaloneHandler =
        self._parser.ExternalEntityRefHandler = self.external_entity_ref
        try:
            self._parser.SkippedEntityHandler = self.skipped_entity_handler
        except AttributeError:
            # This pyexpat does not support SkippedEntity
            pass
        self._parser.SetParamEntityParsing(
            expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)

        self._parsing = 0
        self._entity_stack = []

    # Locator methods

    def getColumnNumber(self):
        if self._parser is None:
            return None
        return self._parser.ErrorColumnNumber

    def getLineNumber(self):
        if self._parser is None:
            return 1
        return self._parser.ErrorLineNumber

    def getPublicId(self):
        return self._source.getPublicId()

    def getSystemId(self):
        return self._source.getSystemId()

    # event handlers
    def start_element(self, name, attrs):
        self._cont_handler.startElement(name, AttributesImpl(attrs))

    def end_element(self, name):
        self._cont_handler.endElement(name)

    def start_element_ns(self, name, attrs):
        pair = name.split()
        if len(pair) == 1:
            # no namespace
            pair = (None, name)
        elif len(pair) == 3:
            pair = pair[0], pair[1]
        else:
            # default namespace
            pair = tuple(pair)

        newattrs = {}
        qnames = {}
        for (aname, value) in attrs.items():
            parts = aname.split()
            length = len(parts)
            if length == 1:
                # no namespace
                qname = aname
                apair = (None, aname)
            elif length == 3:
                qname = "%s:%s" % (parts[2], parts[1])
                apair = parts[0], parts[1]
            else:
                # default namespace
                qname = parts[1]
                apair = tuple(parts)

            newattrs[apair] = value
            qnames[apair] = qname

        self._cont_handler.startElementNS(pair, None,
                                          AttributesNSImpl(newattrs, qnames))

    def end_element_ns(self, name):
        pair = name.split()
        if len(pair) == 1:
            pair = (None, name)
        elif len(pair) == 3:
            pair = pair[0], pair[1]
        else:
            pair = tuple(pair)

        self._cont_handler.endElementNS(pair, None)

    # this is not used (call directly to ContentHandler)
    def processing_instruction(self, target, data):
        self._cont_handler.processingInstruction(target, data)

    # this is not used (call directly to ContentHandler)
    def character_data(self, data):
        self._cont_handler.characters(data)

    def start_namespace_decl(self, prefix, uri):
        self._cont_handler.startPrefixMapping(prefix, uri)

    def end_namespace_decl(self, prefix):
        self._cont_handler.endPrefixMapping(prefix)

    def start_doctype_decl(self, name, sysid, pubid, has_internal_subset):
        self._lex_handler_prop.startDTD(name, pubid, sysid)

    def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name):
        self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name)

    def notation_decl(self, name, base, sysid, pubid):
        self._dtd_handler.notationDecl(name, pubid, sysid)

    def external_entity_ref(self, context, base, sysid, pubid):
        if not self._external_ges:
            return 1

        source = self._ent_handler.resolveEntity(pubid, sysid)
        source = saxutils.prepare_input_source(source,
                                               self._source.getSystemId() or
                                               "")

        self._entity_stack.append((self._parser, self._source))
        self._parser = self._parser.ExternalEntityParserCreate(context)
        self._source = source

        try:
            xmlreader.IncrementalParser.parse(self, source)
        except:
            return 0  # FIXME: save error info here?

        (self._parser, self._source) = self._entity_stack[-1]
        del self._entity_stack[-1]
        return 1

    def skipped_entity_handler(self, name, is_pe):
        if is_pe:
            # The SAX spec requires to report skipped PEs with a '%'
            name = '%'+name
        self._cont_handler.skippedEntity(name)

# ---

def create_parser(*args, **kwargs):
    return ExpatParser(*args, **kwargs)

# ---

if __name__ == "__main__":
    import xml.sax.saxutils
    p = create_parser()
    p.setContentHandler(xml.sax.saxutils.XMLGenerator())
    p.setErrorHandler(xml.sax.ErrorHandler())
    p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml")
xmlreader.py000064400000030614150346007760007115 0ustar00"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. """

from . import handler

from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException


# ===== XMLREADER =====

class XMLReader:
    """Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event."""

    def __init__(self):
        self._cont_handler = handler.ContentHandler()
        self._dtd_handler = handler.DTDHandler()
        self._ent_handler = handler.EntityResolver()
        self._err_handler = handler.ErrorHandler()

    def parse(self, source):
        "Parse an XML document from a system identifier or an InputSource."
        raise NotImplementedError("This method must be implemented!")

    def getContentHandler(self):
        "Returns the current ContentHandler."
        return self._cont_handler

    def setContentHandler(self, handler):
        "Registers a new object to receive document content events."
        self._cont_handler = handler

    def getDTDHandler(self):
        "Returns the current DTD handler."
        return self._dtd_handler

    def setDTDHandler(self, handler):
        "Register an object to receive basic DTD-related events."
        self._dtd_handler = handler

    def getEntityResolver(self):
        "Returns the current EntityResolver."
        return self._ent_handler

    def setEntityResolver(self, resolver):
        "Register an object to resolve external entities."
        self._ent_handler = resolver

    def getErrorHandler(self):
        "Returns the current ErrorHandler."
        return self._err_handler

    def setErrorHandler(self, handler):
        "Register an object to receive error-message events."
        self._err_handler = handler

    def setLocale(self, locale):
        """Allow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse."""
        raise SAXNotSupportedException("Locale support not implemented")

    def getFeature(self, name):
        "Looks up and returns the state of a SAX2 feature."
        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)

    def setFeature(self, name, state):
        "Sets the state of a SAX2 feature."
        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)

    def getProperty(self, name):
        "Looks up and returns the value of a SAX2 property."
        raise SAXNotRecognizedException("Property '%s' not recognized" % name)

    def setProperty(self, name, value):
        "Sets the value of a SAX2 property."
        raise SAXNotRecognizedException("Property '%s' not recognized" % name)

class IncrementalParser(XMLReader):
    """This interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers."""

    def __init__(self, bufsize=2**16):
        self._bufsize = bufsize
        XMLReader.__init__(self)

    def parse(self, source):
        from . import saxutils
        source = saxutils.prepare_input_source(source)

        self.prepareParser(source)
        file = source.getCharacterStream()
        if file is None:
            file = source.getByteStream()
        buffer = file.read(self._bufsize)
        while buffer:
            self.feed(buffer)
            buffer = file.read(self._bufsize)
        self.close()

    def feed(self, data):
        """This method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException."""
        raise NotImplementedError("This method must be implemented!")

    def prepareParser(self, source):
        """This method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing."""
        raise NotImplementedError("prepareParser must be overridden!")

    def close(self):
        """This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException."""
        raise NotImplementedError("This method must be implemented!")

    def reset(self):
        """This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined."""
        raise NotImplementedError("This method must be implemented!")

# ===== LOCATOR =====

class Locator:
    """Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable."""

    def getColumnNumber(self):
        "Return the column number where the current event ends."
        return -1

    def getLineNumber(self):
        "Return the line number where the current event ends."
        return -1

    def getPublicId(self):
        "Return the public identifier for the current event."
        return None

    def getSystemId(self):
        "Return the system identifier for the current event."
        return None

# ===== INPUTSOURCE =====

class InputSource:
    """Encapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those."""

    def __init__(self, system_id = None):
        self.__system_id = system_id
        self.__public_id = None
        self.__encoding  = None
        self.__bytefile  = None
        self.__charfile  = None

    def setPublicId(self, public_id):
        "Sets the public identifier of this InputSource."
        self.__public_id = public_id

    def getPublicId(self):
        "Returns the public identifier of this InputSource."
        return self.__public_id

    def setSystemId(self, system_id):
        "Sets the system identifier of this InputSource."
        self.__system_id = system_id

    def getSystemId(self):
        "Returns the system identifier of this InputSource."
        return self.__system_id

    def setEncoding(self, encoding):
        """Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream."""
        self.__encoding = encoding

    def getEncoding(self):
        "Get the character encoding of this InputSource."
        return self.__encoding

    def setByteStream(self, bytefile):
        """Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method."""
        self.__bytefile = bytefile

    def getByteStream(self):
        """Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown."""
        return self.__bytefile

    def setCharacterStream(self, charfile):
        """Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier."""
        self.__charfile = charfile

    def getCharacterStream(self):
        "Get the character stream for this input source."
        return self.__charfile

# ===== ATTRIBUTESIMPL =====

class AttributesImpl:

    def __init__(self, attrs):
        """Non-NS-aware implementation.

        attrs should be of the form {name : value}."""
        self._attrs = attrs

    def getLength(self):
        return len(self._attrs)

    def getType(self, name):
        return "CDATA"

    def getValue(self, name):
        return self._attrs[name]

    def getValueByQName(self, name):
        return self._attrs[name]

    def getNameByQName(self, name):
        if name not in self._attrs:
            raise KeyError(name)
        return name

    def getQNameByName(self, name):
        if name not in self._attrs:
            raise KeyError(name)
        return name

    def getNames(self):
        return list(self._attrs.keys())

    def getQNames(self):
        return list(self._attrs.keys())

    def __len__(self):
        return len(self._attrs)

    def __getitem__(self, name):
        return self._attrs[name]

    def keys(self):
        return list(self._attrs.keys())

    def __contains__(self, name):
        return name in self._attrs

    def get(self, name, alternative=None):
        return self._attrs.get(name, alternative)

    def copy(self):
        return self.__class__(self._attrs)

    def items(self):
        return list(self._attrs.items())

    def values(self):
        return list(self._attrs.values())

# ===== ATTRIBUTESNSIMPL =====

class AttributesNSImpl(AttributesImpl):

    def __init__(self, attrs, qnames):
        """NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}."""
        self._attrs = attrs
        self._qnames = qnames

    def getValueByQName(self, name):
        for (nsname, qname) in self._qnames.items():
            if qname == name:
                return self._attrs[nsname]

        raise KeyError(name)

    def getNameByQName(self, name):
        for (nsname, qname) in self._qnames.items():
            if qname == name:
                return nsname

        raise KeyError(name)

    def getQNameByName(self, name):
        return self._qnames[name]

    def getQNames(self):
        return list(self._qnames.values())

    def copy(self):
        return self.__class__(self._attrs, self._qnames)


def _test():
    XMLReader()
    IncrementalParser()
    Locator()

if __name__ == "__main__":
    _test()
handler.py000064400000033142150346007760006546 0ustar00"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
"""

version = '2.0beta'

#============================================================================
#
# HANDLER INTERFACES
#
#============================================================================

# ===== ERRORHANDLER =====

class ErrorHandler:
    """Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter."""

    def error(self, exception):
        "Handle a recoverable error."
        raise exception

    def fatalError(self, exception):
        "Handle a non-recoverable error."
        raise exception

    def warning(self, exception):
        "Handle a warning."
        print(exception)


# ===== CONTENTHANDLER =====

class ContentHandler:
    """Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document."""

    def __init__(self):
        self._locator = None

    def setDocumentLocator(self, locator):
        """Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time."""
        self._locator = locator

    def startDocument(self):
        """Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator)."""

    def endDocument(self):
        """Receive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input."""

    def startPrefixMapping(self, prefix, uri):
        """Begin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed."""

    def endPrefixMapping(self, prefix):
        """End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed."""

    def startElement(self, name, attrs):
        """Signals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element."""

    def endElement(self, name):
        """Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event."""

    def startElementNS(self, name, qname, attrs):
        """Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace."""

    def endElementNS(self, name, qname):
        """Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event."""

    def characters(self, content):
        """Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information."""

    def ignorableWhitespace(self, whitespace):
        """Receive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information."""

    def processingInstruction(self, target, data):
        """Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method."""

    def skippedEntity(self, name):
        """Receive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties."""


# ===== DTDHandler =====

class DTDHandler:
    """Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes)."""

    def notationDecl(self, name, publicId, systemId):
        "Handle a notation declaration event."

    def unparsedEntityDecl(self, name, publicId, systemId, ndata):
        "Handle an unparsed entity declaration event."


# ===== ENTITYRESOLVER =====

class EntityResolver:
    """Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour."""

    def resolveEntity(self, publicId, systemId):
        """Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from."""
        return systemId


#============================================================================
#
# CORE FEATURES
#
#============================================================================

feature_namespaces = "http://xml.org/sax/features/namespaces"
# true: Perform Namespace processing (default).
# false: Optionally do not perform Namespace processing
#        (implies namespace-prefixes).
# access: (parsing) read-only; (not parsing) read/write

feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes"
# true: Report the original prefixed names and attributes used for Namespace
#       declarations.
# false: Do not report attributes used for Namespace declarations, and
#        optionally do not report original prefixed names (default).
# access: (parsing) read-only; (not parsing) read/write

feature_string_interning = "http://xml.org/sax/features/string-interning"
# true: All element names, prefixes, attribute names, Namespace URIs, and
#       local names are interned using the built-in intern function.
# false: Names are not necessarily interned, although they may be (default).
# access: (parsing) read-only; (not parsing) read/write

feature_validation = "http://xml.org/sax/features/validation"
# true: Report all validation errors (implies external-general-entities and
#       external-parameter-entities).
# false: Do not report validation errors.
# access: (parsing) read-only; (not parsing) read/write

feature_external_ges = "http://xml.org/sax/features/external-general-entities"
# true: Include all external general (text) entities.
# false: Do not include external general entities.
# access: (parsing) read-only; (not parsing) read/write

feature_external_pes = "http://xml.org/sax/features/external-parameter-entities"
# true: Include all external parameter entities, including the external
#       DTD subset.
# false: Do not include any external parameter entities, even the external
#        DTD subset.
# access: (parsing) read-only; (not parsing) read/write

all_features = [feature_namespaces,
                feature_namespace_prefixes,
                feature_string_interning,
                feature_validation,
                feature_external_ges,
                feature_external_pes]


#============================================================================
#
# CORE PROPERTIES
#
#============================================================================

property_lexical_handler = "http://xml.org/sax/properties/lexical-handler"
# data type: xml.sax.sax2lib.LexicalHandler
# description: An optional extension handler for lexical events like comments.
# access: read/write

property_declaration_handler = "http://xml.org/sax/properties/declaration-handler"
# data type: xml.sax.sax2lib.DeclHandler
# description: An optional extension handler for DTD-related events other
#              than notations and unparsed entities.
# access: read/write

property_dom_node = "http://xml.org/sax/properties/dom-node"
# data type: org.w3c.dom.Node
# description: When parsing, the current DOM node being visited if this is
#              a DOM iterator; when not parsing, the root DOM node for
#              iteration.
# access: (parsing) read-only; (not parsing) read/write

property_xml_string = "http://xml.org/sax/properties/xml-string"
# data type: String
# description: The literal string of characters that was the source for
#              the current event.
# access: read-only

property_encoding = "http://www.python.org/sax/properties/encoding"
# data type: String
# description: The name of the encoding to assume for input data.
# access: write: set the encoding, e.g. established by a higher-level
#                protocol. May change during parsing (e.g. after
#                processing a META tag)
#         read:  return the current encoding (possibly established through
#                auto-detection.
# initial value: UTF-8
#

property_interning_dict = "http://www.python.org/sax/properties/interning-dict"
# data type: Dictionary
# description: The dictionary used to intern common strings in the document
# access: write: Request that the parser uses a specific dictionary, to
#                allow interning across different documents
#         read:  return the current interning dictionary, or None
#

all_properties = [property_lexical_handler,
                  property_dom_node,
                  property_declaration_handler,
                  property_xml_string,
                  property_encoding,
                  property_interning_dict]
__pycache__/_exceptions.cpython-38.opt-1.pyc000064400000012506150346007760014677 0ustar00U

e5d��@s�dZddlZejdd�dkr*ddlmZ[Gdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z	dS)z!Different kinds of SAX Exceptions�N��java)�	Exceptionc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�SAXExceptiona�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.NcCs||_||_t�||�dS)zUCreates an exception. The message is required, but the exception
        is optional.N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r�+/usr/lib64/python3.8/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.�r�r	rrr
�
getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)rrrrr
�getExceptionszSAXException.getExceptioncCs|jS)�0Create a string representation of the exception.rrrrr
�__str__"szSAXException.__str__cCstd��dS)zvAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.�__getitem__N)�AttributeError)r	Zixrrr
r&szSAXException.__getitem__)N)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
r	s	
rc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�SAXParseExceptiona#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCs<t�|||�||_|j��|_|j��|_|j��|_dS)zECreates the exception. The exception parameter is allowed to be None.N)	rr�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r	r
rZlocatorrrr
r;s
zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception
        occurred.)rrrrr
rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r!rrrr
r MszSAXParseException.getLineNumbercCs
|j��S)zEGet the public identifier of the entity where the exception occurred.)r�getPublicIdrrrr
r"QszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)rrrrr
rUszSAXParseException.getSystemIdcCsN|��}|dkrd}|��}|dkr(d}|��}|dkr<d}d||||jfS)rNz	<unknown>�?z%s:%s:%s: %s)rr rr)r	ZsysidZlinenumZcolnumrrr
rYszSAXParseException.__str__N)
rrrrrrr r"rrrrrr
r.s
rc@seZdZdZdS)�SAXNotRecognizedExceptionz�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.N�rrrrrrrr
r$isr$c@seZdZdZdS)�SAXNotSupportedExceptionaException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.Nr%rrrr
r&ssr&c@seZdZdZdS)�SAXReaderNotAvailableaException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.Nr%rrrr
r'}sr')
r�sys�platformZ	java.langrrrr$r&r'rrrr
�<module>s%;

__pycache__/expatreader.cpython-38.pyc000064400000030321150346007760013717 0ustar00U

e5dX=�@s�dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d	d
�dkr|edd	��[zdd
lmZWnek
r�edd	��YnXeed�s�edd	��ddlmZmZmZejZejZzdd	lZWnek
�rdd�ZYnXdd	lZejZ[[Gdd�d�ZGdd�dej�ZGdd�dej ej�Z!dd�Z"e#dk�r�dd	l$Z%e"�Z&e&�'e%j(j�)��e&�*e%j(�+��e&�,d�d	S)z]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S�N�)�orr�+/usr/lib64/python3.8/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ExpatLocatorz�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dSr)r�_ref��self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r�_parser�ErrorColumnNumberrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS�N�)rr!�ErrorLineNumberrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|j��Sr)r�_source�getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|j��Sr)rr(�getSystemIdrrrrr*NszExpatLocator.getSystemIdN)	rrr�__doc__r r#r'r)r*rrrrr3src@seZdZdZdCdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdDdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBS)E�ExpatParserz$SAX driver for the pyexpat C module.r��cCsFtj�||�t��|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserr ZInputSourcer(r!�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrr Zs
zExpatParser.__init__cCsVt�|�}||_z*|��|j�t|��tj�	||�Wn|�
��YnXdS)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer(�reset�
_cont_handlerZsetDocumentLocatorrrr.�parse�
_close_source�r�sourcerrrr9gs
zExpatParser.parsecCs |��dk	r|j�|���dSr)r*r!ZSetBaser;rrr�
prepareParserwszExpatParser.prepareParsercCs tj�||�|jr|��dSr)rr.�setContentHandlerr1�_reset_cont_handler)rrrrrr>}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)Nr�Feature '%s' not recognized)
rr/rr4rrrrr3�SAXNotRecognizedException�r�namerrr�
getFeature�s
�zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr@)r1�SAXNotSupportedExceptionrr/rr3rr4rrrrA)rrC�staterrr�
setFeature�s:
����zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|j��St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsing�Property '%s' not recognized)r�property_lexical_handlerr0r
r4r	r!�hasattrrHrArErBrrr�getProperty�s

��zExpatParser.getPropertycCsV|tjkr ||_|jrR|��n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setrI)
rrJr0r1�_reset_lex_handler_propr
r4r	rErA)rrC�valuerrr�setProperty�s

��zExpatParser.setPropertyc
Csz|js|��d|_|j��z|j�||�WnDtjk
rt}z$tt�	|j
�||�}|j�|�W5d}~XYnXdSr$)
r1r7r8Z
startDocumentr!ZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|��}|dk	r |��W5|��}|dk	r<|��XdSr)r(Z
getByteStream�closeZgetCharacterStream)rr<�filerrrr:�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|j	�
�d|_d|_W5d|_|jdk	rzt�}|jj|_|jj|_||_|��XdS)Nr�r%)rS)r2r!�
isinstancerr1r"r&r:rVr8ZendDocumentrrrrrW�s 
�




zExpatParser.closecCs|jj|j_|jj|j_dSr)r8�processingInstructionr!ZProcessingInstructionHandler�
charactersZCharacterDataHandler�rrrrr?�s�zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dSr)r0r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrMsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|j��d|jd�|_d|j_|j|j_	|j
|j_n,tj|j��|jd�|_|j|j_	|j
|j_|��|j|j_|j|j_|j|j_|j|j_d|_|jr�|��|j|j_z|j|j_Wntk
r�YnX|j�tj �d|_!g|_"dS)N� )�internr%r)#r/r
rr(ZgetEncodingr4r!Znamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr?�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr0rM�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr1r2r]rrrr7s<�
�






�zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r]rrrr#;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r]rrrr'@s
zExpatParser.getLineNumbercCs
|j��Sr)r(r)r]rrrr)EszExpatParser.getPublicIdcCs
|j��Sr)r(r*r]rrrr*HszExpatParser.getSystemIdcCs|j�|t|��dSr)r8ZstartElement�AttributesImpl)rrC�attrsrrrrcLszExpatParser.start_elementcCs|j�|�dSr)r8Z
endElementrBrrrrdOszExpatParser.end_elementcCs�|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}|��D]|\}}|��}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qT|j�|dt||��dS)Nr%�rz%s:%s�)�split�len�tuple�itemsr8ZstartElementNS�AttributesNSImpl)rrCrm�pairZnewattrsZqnamesZanamerN�partsZlengthZqnameZapairrrrraRs0



�zExpatParser.start_element_nscCsV|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|j�|d�dS)Nr%rnr)rprqrrr8ZendElementNS)rrCrurrrrbts
zExpatParser.end_element_nscCs|j�||�dSr)r8r[)r�targetrRrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|j�|�dSr)r8r\)rrRrrr�character_data�szExpatParser.character_datacCs|j�||�dSr)r8ZstartPrefixMapping)r�prefixZurirrrrg�sz ExpatParser.start_namespace_declcCs|j�|�dSr)r8ZendPrefixMapping)rrzrrrrh�szExpatParser.end_namespace_declcCs|j�|||�dSr)r0ZstartDTD)rrC�sysid�pubidZhas_internal_subsetrrrr^�szExpatParser.start_doctype_declcCs|j�||||�dSr)�_dtd_handlerZunparsedEntityDecl)rrC�baser{r|Z
notation_namerrrre�sz ExpatParser.unparsed_entity_declcCs|j�|||�dSr)r}ZnotationDecl)rrCr~r{r|rrrrf�szExpatParser.notation_declcCs�|js
dS|j�||�}t�||j��p*d�}|j�|j	|jf�|j	�
|�|_	||_ztj�
||�WnYdSX|jd\|_	|_|jd=dS)Nr%rYr���)r3Z_ent_handlerZ
resolveEntityrr6r(r*r2�appendr!ZExternalEntityParserCreaterr.r9)r�contextr~r{r|r<rrrri�s"
�zExpatParser.external_entity_refcCs|rd|}|j�|�dS)N�%)r8Z
skippedEntity)rrCZis_perrrrj�sz"ExpatParser.skipped_entity_handlerN)rr-)r)#rrrr+r r9r=r>rDrGrLrOrVr:rWr?rMr7r#r'r)r*rcrdrarbrxryrgrhr^rerfrirjrrrrr,Ws@


'"r,cOs
t||�Sr)r,)�args�kwargsrrr�
create_parser�sr��__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r+�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrKZxml.saxrrrrlrt�_weakrefr�weakref�proxyrZLocatorrr.r,r�rZxml.sax.saxutilsZxml�pr>ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr9rrrr�<module>sN


$_
__pycache__/_exceptions.cpython-38.opt-2.pyc000064400000005433150346007760014701 0ustar00U

e5d��@s|ddlZejdd�dkr&ddlmZ[Gdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZdS)�N��java)�	Exceptionc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�SAXExceptionNcCs||_||_t�||�dS�N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r
�+/usr/lib64/python3.8/xml/sax/_exceptions.pyr	szSAXException.__init__cCs|jSr�r�r
r
r
r�
getMessageszSAXException.getMessagecCs|jSr)rrr
r
r�getExceptionszSAXException.getExceptioncCs|jSrrrr
r
r�__str__"szSAXException.__str__cCstd��dS)N�__getitem__)�AttributeError)r
Zixr
r
rr&szSAXException.__getitem__)N)�__name__�
__module__�__qualname__r	rrrrr
r
r
rr	s


rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�SAXParseExceptioncCs<t�|||�||_|j��|_|j��|_|j��|_dSr)	rr	�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r
rrZlocatorr
r
rr	;s
zSAXParseException.__init__cCs|jSr)rrr
r
rrHsz!SAXParseException.getColumnNumbercCs|jSr)r rr
r
rrMszSAXParseException.getLineNumbercCs
|j��Sr)r�getPublicIdrr
r
rr!QszSAXParseException.getPublicIdcCs|jSr)rrr
r
rrUszSAXParseException.getSystemIdcCsN|��}|dkrd}|��}|dkr(d}|��}|dkr<d}d||||jfS)Nz	<unknown>�?z%s:%s:%s: %s)rrrr)r
ZsysidZlinenumZcolnumr
r
rrYszSAXParseException.__str__N)	rrrr	rrr!rrr
r
r
rr.s

rc@seZdZdS)�SAXNotRecognizedExceptionN�rrrr
r
r
rr#isr#c@seZdZdS)�SAXNotSupportedExceptionNr$r
r
r
rr%ssr%c@seZdZdS)�SAXReaderNotAvailableNr$r
r
r
rr&}sr&)	�sys�platformZ	java.langrrrr#r%r&r
r
r
r�<module>s%;

__pycache__/xmlreader.cpython-38.pyc000064400000040716150346007760013407 0ustar00U

e5d�1�@s�dZddlmZddlmZmZGdd�d�ZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
Gdd�de
�Zdd�Ze
dkr�e�dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�	XMLReadera%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs,t��|_t��|_t��|_t��|_dS�N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler��self�r
�)/usr/lib64/python3.8/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS)zAParse an XML document from a system identifier or an InputSource.� This method must be implemented!N��NotImplementedError�r�sourcer
r
r�parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.�rrr
r
r�getContentHandler"szXMLReader.getContentHandlercCs
||_dS)z:Registers a new object to receive document content events.Nr�rrr
r
r�setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.�rrr
r
r�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dS)z7Register an object to receive basic DTD-related events.Nrrr
r
r�
setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.�r	rr
r
r�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dS)z0Register an object to resolve external entities.Nr)rZresolverr
r
r�setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.�r
rr
r
r�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dS)z3Register an object to receive error-message events.Nr rr
r
r�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)aHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.zLocale support not implementedN)r)rZlocaler
r
r�	setLocaleBszXMLReader.setLocalecCstd|��dS)z1Looks up and returns the state of a SAX2 feature.�Feature '%s' not recognizedN�r�r�namer
r
r�
getFeatureKszXMLReader.getFeaturecCstd|��dS)z!Sets the state of a SAX2 feature.r$Nr%)rr'�stater
r
r�
setFeatureOszXMLReader.setFeaturecCstd|��dS)z2Looks up and returns the value of a SAX2 property.�Property '%s' not recognizedNr%r&r
r
r�getPropertySszXMLReader.getPropertycCstd|��dS)z"Sets the value of a SAX2 property.r+Nr%)rr'�valuer
r
r�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr!r"r#r(r*r,r.r
r
r
rrs 	rc@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�IncrementalParserasThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.�cCs||_t�|�dSr)�_bufsizerr)r�bufsizer
r
rroszIncrementalParser.__init__cCslddlm}|�|�}|�|�|��}|dkr8|��}|�|j�}|r`|�|�|�|j�}qD|�	�dS)Nr)�saxutils)
�r7Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr5�feed�close)rrr7�file�bufferr
r
rrss


zIncrementalParser.parsecCstd��dS)aThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.rNr)r�datar
r
rr=�szIncrementalParser.feedcCstd��dS)ztThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!Nrrr
r
rr9�szIncrementalParser.prepareParsercCstd��dS)a�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.rNrrr
r
rr>�szIncrementalParser.closecCstd��dS)z�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.rNrrr
r
r�reset�szIncrementalParser.resetN)r4)
r/r0r1r2rrr=r9r>rBr
r
r
rr3[s
	
r3c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Locatorz�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS)z6Return the column number where the current event ends.���r
rr
r
r�getColumnNumber�szLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rDr
rr
r
r�
getLineNumber�szLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr
rr
r
r�getPublicId�szLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr
rr
r
r�getSystemId�szLocator.getSystemIdN)r/r0r1r2rErFrGrHr
r
r
rrC�s
rCc@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�InputSourceanEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dSr)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile�rZ	system_idr
r
rr�s
zInputSource.__init__cCs
||_dS)z/Sets the public identifier of this InputSource.N�rK)rZ	public_idr
r
r�setPublicId�szInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.rPrr
r
rrG�szInputSource.getPublicIdcCs
||_dS)z/Sets the system identifier of this InputSource.N�rJrOr
r
r�setSystemId�szInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.rRrr
r
rrH�szInputSource.getSystemIdcCs
||_dS)a4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N�rL)r�encodingr
r
r�setEncoding�szInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.rTrr
r
r�getEncoding�szInputSource.getEncodingcCs
||_dS)a�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N�rM)rZbytefiler
r
r�
setByteStream�szInputSource.setByteStreamcCs|jS)z�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.rXrr
r
rr;�szInputSource.getByteStreamcCs
||_dS)a^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N�rN)rZcharfiler
r
r�setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.rZrr
r
rr:szInputSource.getCharacterStream)N)r/r0r1r2rrQrGrSrHrVrWrYr;r[r:r
r
r
rrI�s



rIc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dS)zQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N��_attrs)r�attrsr
r
rrszAttributesImpl.__init__cCs
t|j�Sr��lenr^rr
r
r�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr
r&r
r
r�getType!szAttributesImpl.getTypecCs
|j|Srr]r&r
r
r�getValue$szAttributesImpl.getValuecCs
|j|Srr]r&r
r
r�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|Sr�r^�KeyErrorr&r
r
r�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|Srrfr&r
r
r�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|j���Sr��listr^�keysrr
r
r�getNames4szAttributesImpl.getNamescCst|j���Srrjrr
r
r�	getQNames7szAttributesImpl.getQNamescCs
t|j�Srr`rr
r
r�__len__:szAttributesImpl.__len__cCs
|j|Srr]r&r
r
r�__getitem__=szAttributesImpl.__getitem__cCst|j���Srrjrr
r
rrl@szAttributesImpl.keyscCs
||jkSrr]r&r
r
r�__contains__CszAttributesImpl.__contains__NcCs|j�||�Sr)r^�get)rr'�alternativer
r
rrrFszAttributesImpl.getcCs|�|j�Sr)�	__class__r^rr
r
r�copyIszAttributesImpl.copycCst|j���Sr)rkr^�itemsrr
r
rrvLszAttributesImpl.itemscCst|j���Sr)rkr^�valuesrr
r
rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr
r
r
rr\s"
r\c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dS)z�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N)r^�_qnames)rr_Zqnamesr
r
rrVszAttributesNSImpl.__init__cCs6|j��D]\}}||kr
|j|Sq
t|��dSr)ryrvr^rg�rr'ZnsnameZqnamer
r
rre^sz AttributesNSImpl.getValueByQNamecCs0|j��D]\}}||kr
|Sq
t|��dSr)ryrvrgrzr
r
rrhes
zAttributesNSImpl.getNameByQNamecCs
|j|Sr)ryr&r
r
rrilszAttributesNSImpl.getQNameByNamecCst|j���Sr)rkryrwrr
r
rrnoszAttributesNSImpl.getQNamescCs|�|j|j�Sr)rtr^ryrr
r
rrurszAttributesNSImpl.copyN)	r/r0r1rrerhrirnrur
r
r
rrxTsrxcCst�t�t�dSr)rr3rCr
r
r
r�_testvsr{�__main__N)r2r8r�_exceptionsrrrr3rCrIr\rxr{r/r
r
r
r�<module>sPJY>"__pycache__/__init__.cpython-38.opt-1.pyc000064400000006225150346007760014117 0ustar00U

e5d?�@s
dZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�fdd�Ze�fdd�Z
d	gZd
Zernd
dlZd
dlZd
dlZejjs�dejkr�ejd�d
�Z[dZejdd�dkr�ej�e�r�ej�e��d
�Zddd�Zejdd�dkr�dd�Zndd�Z[dS)a�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|�|�|�|�|�|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.8/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|�|�|�|�t�}t|t�rR|�|�	|��n|�
|�|��|�|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javarcCsxt|�tD]\}zt|�WStk
rT}zddl}||jkrD�W5d}~XYqtk
rfYqXqtdd��dS)a3Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the iterable created by chaining parser_list and
    default_parser_list.  The iterables must contain the names of Python
    modules containing both a SAX parser and a create_parser function.rNzNo parsers found)�list�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er#rrrr
Fs
r
cCs$ddlm}|�|dt��}|��S)Nr)�imp)Zorg.python.corer'Z
importName�globals�
create_parser)r%r'�
drv_modulerrrr!asr!cCst|iidg�}|��S)Nr))�
__import__r))r%r*rrrr!gs)r)�__doc__Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr �_falseZxml.sax.expatreaderZxml�osr#�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r!rrrr�<module>s*

__pycache__/expatreader.cpython-38.opt-2.pyc000064400000027466150346007760014677 0ustar00U

e5dX=�@s�dZddlTddlmZmZddlmZddlmZmZddlmZddlm	Z	m
Z
ddlZejdd	�d
krxe
dd��[zddlmZWnek
r�e
d
d��YnXeed�s�e
d
d��ddlmZmZmZejZejZzddlZWnek
�rdd�ZYnXddlZejZ[[Gdd�d�ZGdd�dej�ZGdd�dejej�Z dd�Z!e"dk�r�ddl#Z$e!�Z%e%�&e$j'j�(��e%�)e$j'�*��e%�+d�dS)z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S�N�)�orr�+/usr/lib64/python3.8/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ExpatLocatorcCst|�|_dSr)r�_ref��self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r�_parser�ErrorColumnNumberrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS�N�)rr!�ErrorLineNumberrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|j��Sr)r�_source�getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|j��Sr)rr(�getSystemIdrrrrr*NszExpatLocator.getSystemIdN)rrrr r#r'r)r*rrrrr3s
rc@seZdZdBdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dCdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAS)D�ExpatParserr��cCsFtj�||�t��|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserr ZInputSourcer(r!�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrr Zs
zExpatParser.__init__cCsVt�|�}||_z*|��|j�t|��tj�	||�Wn|�
��YnXdSr)r�prepare_input_sourcer(�reset�
_cont_handlerZsetDocumentLocatorrrr-�parse�
_close_source�r�sourcerrrr8gs
zExpatParser.parsecCs |��dk	r|j�|���dSr)r*r!ZSetBaser:rrr�
prepareParserwszExpatParser.prepareParsercCs tj�||�|jr|��dSr)rr-�setContentHandlerr0�_reset_cont_handler)rrrrrr=}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)Nr�Feature '%s' not recognized)
rr.rr3rrrrr2�SAXNotRecognizedException�r�namerrr�
getFeature�s
�zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr?)r0�SAXNotSupportedExceptionrr.rr2rr3rrrr@)rrB�staterrr�
setFeature�s:
����zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|j��St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsing�Property '%s' not recognized)r�property_lexical_handlerr/r
r3r	r!�hasattrrGr@rDrArrr�getProperty�s

��zExpatParser.getPropertycCsV|tjkr ||_|jrR|��n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setrH)
rrIr/r0�_reset_lex_handler_propr
r3r	rDr@)rrB�valuerrr�setProperty�s

��zExpatParser.setPropertyc
Csz|js|��d|_|j��z|j�||�WnDtjk
rt}z$tt�	|j
�||�}|j�|�W5d}~XYnXdSr$)
r0r6r7Z
startDocumentr!ZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|��}|dk	r |��W5|��}|dk	r<|��XdSr)r(Z
getByteStream�closeZgetCharacterStream)rr;�filerrrr9�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|j	�
�d|_d|_W5d|_|jdk	rzt�}|jj|_|jj|_||_|��XdS)Nr�r%)rR)r1r!�
isinstancerr0r"r&r9rUr7ZendDocumentrrrrrV�s 
�




zExpatParser.closecCs|jj|j_|jj|j_dSr)r7�processingInstructionr!ZProcessingInstructionHandler�
charactersZCharacterDataHandler�rrrrr>�s�zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dSr)r/r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrLsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|j��d|jd�|_d|j_|j|j_	|j
|j_n,tj|j��|jd�|_|j|j_	|j
|j_|��|j|j_|j|j_|j|j_|j|j_d|_|jr�|��|j|j_z|j|j_Wntk
r�YnX|j�tj �d|_!g|_"dS)N� )�internr%r)#r.r
rr(ZgetEncodingr3r!Znamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr>�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rL�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1r\rrrr6s<�
�






�zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r\rrrr#;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r\rrrr'@s
zExpatParser.getLineNumbercCs
|j��Sr)r(r)r\rrrr)EszExpatParser.getPublicIdcCs
|j��Sr)r(r*r\rrrr*HszExpatParser.getSystemIdcCs|j�|t|��dSr)r7ZstartElement�AttributesImpl)rrB�attrsrrrrbLszExpatParser.start_elementcCs|j�|�dSr)r7Z
endElementrArrrrcOszExpatParser.end_elementcCs�|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}|��D]|\}}|��}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qT|j�|dt||��dS)Nr%�rz%s:%s�)�split�len�tuple�itemsr7ZstartElementNS�AttributesNSImpl)rrBrl�pairZnewattrsZqnamesZanamerM�partsZlengthZqnameZapairrrrr`Rs0



�zExpatParser.start_element_nscCsV|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|j�|d�dS)Nr%rmr)rorprqr7ZendElementNS)rrBrtrrrrats
zExpatParser.end_element_nscCs|j�||�dSr)r7rZ)r�targetrQrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|j�|�dSr)r7r[)rrQrrr�character_data�szExpatParser.character_datacCs|j�||�dSr)r7ZstartPrefixMapping)r�prefixZurirrrrf�sz ExpatParser.start_namespace_declcCs|j�|�dSr)r7ZendPrefixMapping)rryrrrrg�szExpatParser.end_namespace_declcCs|j�|||�dSr)r/ZstartDTD)rrB�sysid�pubidZhas_internal_subsetrrrr]�szExpatParser.start_doctype_declcCs|j�||||�dSr)�_dtd_handlerZunparsedEntityDecl)rrB�baserzr{Z
notation_namerrrrd�sz ExpatParser.unparsed_entity_declcCs|j�|||�dSr)r|ZnotationDecl)rrBr}rzr{rrrre�szExpatParser.notation_declcCs�|js
dS|j�||�}t�||j��p*d�}|j�|j	|jf�|j	�
|�|_	||_ztj�
||�WnYdSX|jd\|_	|_|jd=dS)Nr%rXr���)r2Z_ent_handlerZ
resolveEntityrr5r(r*r1�appendr!ZExternalEntityParserCreaterr-r8)r�contextr}rzr{r;rrrrh�s"
�zExpatParser.external_entity_refcCs|rd|}|j�|�dS)N�%)r7Z
skippedEntity)rrBZis_perrrri�sz"ExpatParser.skipped_entity_handlerN)rr,)r)"rrrr r8r<r=rCrFrKrNrUr9rVr>rLr6r#r'r)r*rbrcr`rarwrxrfrgr]rdrerhrirrrrr+Ws>


'"r+cOs
t||�Sr)r+)�args�kwargsrrr�
create_parser�sr��__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrJZxml.saxrrrrkrs�_weakrefr�weakref�proxyrZLocatorrr-r+r�rZxml.sax.saxutilsZxml�pr=ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr8rrrr�<module>sL


$_
__pycache__/__init__.cpython-38.opt-2.pyc000064400000004156150346007760014121 0ustar00U

e5d?�@sddlmZddlmZmZddlmZmZmZm	Z	m
Z
e�fdd�Ze�fdd�ZdgZ
d	Zerjd	d
lZd	d
lZd	d
lZejjs�dejkr�ejd�d�Z
[d
Zejd
d�dkr�ej�e�r�ej�e��d�Z
ddd�Zejd
d�dkr�dd�Zndd�Z[d
S)�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|�|�|�|�|�|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.8/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|�|�|�|�t�}t|t�rR|�|�	|��n|�
|�|��|�|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javarcCsxt|�tD]\}zt|�WStk
rT}zddl}||jkrD�W5d}~XYqtk
rfYqXqtdd��dS)NrzNo parsers found)�list�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er#rrrr
Fs
r
cCs$ddlm}|�|dt��}|��S)Nr)�imp)Zorg.python.corer'Z
importName�globals�
create_parser)r%r'�
drv_modulerrrr!asr!cCst|iidg�}|��S)Nr))�
__import__r))r%r*rrrr!gs)r)Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr �_falseZxml.sax.expatreaderZxml�osr#�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r!rrrr�<module>s(

__pycache__/saxutils.cpython-38.opt-1.pyc000064400000031171150346007760014232 0ustar00U

e5d�/�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	dd�Z
ifdd	�Zifd
d�Zifdd
�Z
dd�ZGdd�dej�ZGdd�de	j�Zddd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreadercCs"|��D]\}}|�||�}q|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.8/xml/sax/saxutils.py�__dict_replacesr
cCs6|�dd�}|�dd�}|�dd�}|r2t||�}|S)z�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    �&�&amp;�>�&gt;�<�&lt;�rr
��dataZentitiesrrr�escapes	
rcCs2|�dd�}|�dd�}|r&t||�}|�dd�S)a
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    rrrrrrrrrrr�unescape"s

rcCsR|dddd��}t||�}d|krFd|kr<d|�dd�}qNd	|}nd|}|S)
a�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')rrrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDt�
�}dd�|_�j|_z�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S�N)�getattr��self�name��outrr�__getattr__Zsz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r&rr$rr�_wrapperXsr+cSsdSrrrrrr�<lambda>]�z _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrrr,br-�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r%r/r3r+�bufferrr$r�_gettextwriterGs0
�rEc@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtj�|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)N���F)r�ContentHandler�__init__rEr?�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r"r%r/Zshort_empty_elementsrrrrJrs
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rO)r"r#�prefixrrr�_qname~szXMLGenerator._qnamecCs|jr|�d�d|_dS)NrF�rSrK)r"�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|�d|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rKrQ�r"rrr�
startDocument�s�zXMLGenerator.startDocumentcCs|��dSr)rMrZrrr�endDocument�szXMLGenerator.endDocumentcCs0|j�|j���||j|<|j�||f�dSr)rN�appendrO�copyrP�r"rU�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrO�r"rUrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCsZ|��|�d|�|��D]\}}|�d|t|�f�q|jrLd|_n
|�d�dS)Nr� %s=%sTr)rYrKrrrRrS)r"r#�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|�d�d|_n|�d|�dS�Nz/>Fz</%s>rWr!rrrrX�s
zXMLGenerator.endElementcCs�|��|�d|�|��|jD].\}}|rB|�d||f�q"|�d|�q"g|_|��D]$\}}|�d|�|�t|�f�q`|jr�d|_n
|�d�dS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#�qnamererUr`r
rrr�startElementNS�szXMLGenerator.startElementNScCs0|jr|�d�d|_n|�d|�|��dSrg)rSrKrV�r"r#rhrrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|��t|t�s"t||j�}|�t|��dSr)rYr5�strrQrKr�r"Zcontentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|��t|t�s"t||j�}|�|�dSr)rYr5rlrQrKrmrrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|��|�d||f�dS)Nz	<?%s %s?>)rYrK�r"�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrrrrrrFps


rFc@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)<�
XMLFilterBaseaYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.NcCstj�|�||_dSr)r�	XMLReaderrJ�_parent�r"�parentrrrrJ�szXMLFilterBase.__init__cCs|j�|�dSr)�_err_handler�error�r"Z	exceptionrrrry�szXMLFilterBase.errorcCs|j�|�dSr)rx�
fatalErrorrzrrrr{�szXMLFilterBase.fatalErrorcCs|j�|�dSr)rx�warningrzrrrr|�szXMLFilterBase.warningcCs|j�|�dSr)�
_cont_handler�setDocumentLocator)r"Zlocatorrrrr~�sz XMLFilterBase.setDocumentLocatorcCs|j��dSr)r}r[rZrrrr[�szXMLFilterBase.startDocumentcCs|j��dSr)r}r\rZrrrr\szXMLFilterBase.endDocumentcCs|j�||�dSr)r}rar_rrrrasz XMLFilterBase.startPrefixMappingcCs|j�|�dSr)r}rcrbrrrrcszXMLFilterBase.endPrefixMappingcCs|j�||�dSr)r}rf)r"r#rerrrrfszXMLFilterBase.startElementcCs|j�|�dSr)r}rXr!rrrrXszXMLFilterBase.endElementcCs|j�|||�dSr)r}ri)r"r#rhrerrrriszXMLFilterBase.startElementNScCs|j�||�dSr)r}rkrjrrrrkszXMLFilterBase.endElementNScCs|j�|�dSr)r}rnrmrrrrnszXMLFilterBase.characterscCs|j�|�dSr)r}ro)r"�charsrrrrosz!XMLFilterBase.ignorableWhitespacecCs|j�||�dSr)r}rrrprrrrrsz#XMLFilterBase.processingInstructioncCs|j�|�dSr)r}�
skippedEntityr!rrrr� szXMLFilterBase.skippedEntitycCs|j�|||�dSr)�_dtd_handler�notationDecl)r"r#�publicId�systemIdrrrr�%szXMLFilterBase.notationDeclcCs|j�||||�dSr)r��unparsedEntityDecl)r"r#r�r�Zndatarrrr�(sz XMLFilterBase.unparsedEntityDeclcCs|j�||�Sr)Z_ent_handler�
resolveEntity)r"r�r�rrrr�-szXMLFilterBase.resolveEntitycCs@|j�|�|j�|�|j�|�|j�|�|j�|�dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r"�sourcerrrr�2s
zXMLFilterBase.parsecCs|j�|�dSr)ru�	setLocale)r"Zlocalerrrr�9szXMLFilterBase.setLocalecCs|j�|�Sr)ru�
getFeaturer!rrrr�<szXMLFilterBase.getFeaturecCs|j�||�dSr)ru�
setFeature)r"r#�staterrrr�?szXMLFilterBase.setFeaturecCs|j�|�Sr)ru�getPropertyr!rrrr�BszXMLFilterBase.getPropertycCs|j�||�dSr)ru�setProperty)r"r#r
rrrr�EszXMLFilterBase.setPropertycCs|jSr�rurZrrr�	getParentJszXMLFilterBase.getParentcCs
||_dSrr�rvrrr�	setParentMszXMLFilterBase.setParent)N) r'r(r)�__doc__rJryr{r|r~r[r\rarcrfrXrirkrnrorrr�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�s:
rs�cCs$t|tj�rt�|�}t|t�r,t�|�}n^t|d�r�|}t��}t|�d�t�r^|�	|�n
|�
|�t|d�r�t|jt�r�|�|j�|�
�dk�r |��dk�r |��}tj�tj�|��}tj�||�}tj�|�r�|�|�t|d�}n$|�tj�||��tj�|���}|�
|�|S)z�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.�readrr#N�rb)r5�os�PathLike�fspathrlrZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamr#ZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�path�dirname�normpath�join�isfile�open�urllibr�ZurljoinZrequestZurlopen)r��base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceRs.





r�)r�)r�r�Zurllib.parser�Zurllib.requestr6r8r�rrr
rrrrErIrFrtrsr�rrrr�<module>s)so__pycache__/expatreader.cpython-38.opt-1.pyc000064400000030321150346007760014656 0ustar00U

e5dX=�@s�dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d	d
�dkr|edd	��[zdd
lmZWnek
r�edd	��YnXeed�s�edd	��ddlmZmZmZejZejZzdd	lZWnek
�rdd�ZYnXdd	lZejZ[[Gdd�d�ZGdd�dej�ZGdd�dej ej�Z!dd�Z"e#dk�r�dd	l$Z%e"�Z&e&�'e%j(j�)��e&�*e%j(�+��e&�,d�d	S)z]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S�N�)�orr�+/usr/lib64/python3.8/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ExpatLocatorz�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dSr)r�_ref��self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r�_parser�ErrorColumnNumberrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS�N�)rr!�ErrorLineNumberrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|j��Sr)r�_source�getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|j��Sr)rr(�getSystemIdrrrrr*NszExpatLocator.getSystemIdN)	rrr�__doc__r r#r'r)r*rrrrr3src@seZdZdZdCdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdDdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBS)E�ExpatParserz$SAX driver for the pyexpat C module.r��cCsFtj�||�t��|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserr ZInputSourcer(r!�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrr Zs
zExpatParser.__init__cCsVt�|�}||_z*|��|j�t|��tj�	||�Wn|�
��YnXdS)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer(�reset�
_cont_handlerZsetDocumentLocatorrrr.�parse�
_close_source�r�sourcerrrr9gs
zExpatParser.parsecCs |��dk	r|j�|���dSr)r*r!ZSetBaser;rrr�
prepareParserwszExpatParser.prepareParsercCs tj�||�|jr|��dSr)rr.�setContentHandlerr1�_reset_cont_handler)rrrrrr>}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)Nr�Feature '%s' not recognized)
rr/rr4rrrrr3�SAXNotRecognizedException�r�namerrr�
getFeature�s
�zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr@)r1�SAXNotSupportedExceptionrr/rr3rr4rrrrA)rrC�staterrr�
setFeature�s:
����zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|j��St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsing�Property '%s' not recognized)r�property_lexical_handlerr0r
r4r	r!�hasattrrHrArErBrrr�getProperty�s

��zExpatParser.getPropertycCsV|tjkr ||_|jrR|��n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setrI)
rrJr0r1�_reset_lex_handler_propr
r4r	rErA)rrC�valuerrr�setProperty�s

��zExpatParser.setPropertyc
Csz|js|��d|_|j��z|j�||�WnDtjk
rt}z$tt�	|j
�||�}|j�|�W5d}~XYnXdSr$)
r1r7r8Z
startDocumentr!ZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|��}|dk	r |��W5|��}|dk	r<|��XdSr)r(Z
getByteStream�closeZgetCharacterStream)rr<�filerrrr:�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|j	�
�d|_d|_W5d|_|jdk	rzt�}|jj|_|jj|_||_|��XdS)Nr�r%)rS)r2r!�
isinstancerr1r"r&r:rVr8ZendDocumentrrrrrW�s 
�




zExpatParser.closecCs|jj|j_|jj|j_dSr)r8�processingInstructionr!ZProcessingInstructionHandler�
charactersZCharacterDataHandler�rrrrr?�s�zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dSr)r0r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrMsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|j��d|jd�|_d|j_|j|j_	|j
|j_n,tj|j��|jd�|_|j|j_	|j
|j_|��|j|j_|j|j_|j|j_|j|j_d|_|jr�|��|j|j_z|j|j_Wntk
r�YnX|j�tj �d|_!g|_"dS)N� )�internr%r)#r/r
rr(ZgetEncodingr4r!Znamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr?�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr0rM�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr1r2r]rrrr7s<�
�






�zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r]rrrr#;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r]rrrr'@s
zExpatParser.getLineNumbercCs
|j��Sr)r(r)r]rrrr)EszExpatParser.getPublicIdcCs
|j��Sr)r(r*r]rrrr*HszExpatParser.getSystemIdcCs|j�|t|��dSr)r8ZstartElement�AttributesImpl)rrC�attrsrrrrcLszExpatParser.start_elementcCs|j�|�dSr)r8Z
endElementrBrrrrdOszExpatParser.end_elementcCs�|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}|��D]|\}}|��}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qT|j�|dt||��dS)Nr%�rz%s:%s�)�split�len�tuple�itemsr8ZstartElementNS�AttributesNSImpl)rrCrm�pairZnewattrsZqnamesZanamerN�partsZlengthZqnameZapairrrrraRs0



�zExpatParser.start_element_nscCsV|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|j�|d�dS)Nr%rnr)rprqrrr8ZendElementNS)rrCrurrrrbts
zExpatParser.end_element_nscCs|j�||�dSr)r8r[)r�targetrRrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|j�|�dSr)r8r\)rrRrrr�character_data�szExpatParser.character_datacCs|j�||�dSr)r8ZstartPrefixMapping)r�prefixZurirrrrg�sz ExpatParser.start_namespace_declcCs|j�|�dSr)r8ZendPrefixMapping)rrzrrrrh�szExpatParser.end_namespace_declcCs|j�|||�dSr)r0ZstartDTD)rrC�sysid�pubidZhas_internal_subsetrrrr^�szExpatParser.start_doctype_declcCs|j�||||�dSr)�_dtd_handlerZunparsedEntityDecl)rrC�baser{r|Z
notation_namerrrre�sz ExpatParser.unparsed_entity_declcCs|j�|||�dSr)r}ZnotationDecl)rrCr~r{r|rrrrf�szExpatParser.notation_declcCs�|js
dS|j�||�}t�||j��p*d�}|j�|j	|jf�|j	�
|�|_	||_ztj�
||�WnYdSX|jd\|_	|_|jd=dS)Nr%rYr���)r3Z_ent_handlerZ
resolveEntityrr6r(r*r2�appendr!ZExternalEntityParserCreaterr.r9)r�contextr~r{r|r<rrrri�s"
�zExpatParser.external_entity_refcCs|rd|}|j�|�dS)N�%)r8Z
skippedEntity)rrCZis_perrrrj�sz"ExpatParser.skipped_entity_handlerN)rr-)r)#rrrr+r r9r=r>rDrGrLrOrVr:rWr?rMr7r#r'r)r*rcrdrarbrxryrgrhr^rerfrirjrrrrr,Ws@


'"r,cOs
t||�Sr)r,)�args�kwargsrrr�
create_parser�sr��__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r+�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrKZxml.saxrrrrlrt�_weakrefr�weakref�proxyrZLocatorrr.r,r�rZxml.sax.saxutilsZxml�pr>ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr9rrrr�<module>sN


$_
__pycache__/_exceptions.cpython-38.pyc000064400000012506150346007760013740 0ustar00U

e5d��@s�dZddlZejdd�dkr*ddlmZ[Gdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z	dS)z!Different kinds of SAX Exceptions�N��java)�	Exceptionc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�SAXExceptiona�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.NcCs||_||_t�||�dS)zUCreates an exception. The message is required, but the exception
        is optional.N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r�+/usr/lib64/python3.8/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.�r�r	rrr
�
getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)rrrrr
�getExceptionszSAXException.getExceptioncCs|jS)�0Create a string representation of the exception.rrrrr
�__str__"szSAXException.__str__cCstd��dS)zvAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.�__getitem__N)�AttributeError)r	Zixrrr
r&szSAXException.__getitem__)N)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
r	s	
rc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�SAXParseExceptiona#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCs<t�|||�||_|j��|_|j��|_|j��|_dS)zECreates the exception. The exception parameter is allowed to be None.N)	rr�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r	r
rZlocatorrrr
r;s
zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception
        occurred.)rrrrr
rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r!rrrr
r MszSAXParseException.getLineNumbercCs
|j��S)zEGet the public identifier of the entity where the exception occurred.)r�getPublicIdrrrr
r"QszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)rrrrr
rUszSAXParseException.getSystemIdcCsN|��}|dkrd}|��}|dkr(d}|��}|dkr<d}d||||jfS)rNz	<unknown>�?z%s:%s:%s: %s)rr rr)r	ZsysidZlinenumZcolnumrrr
rYszSAXParseException.__str__N)
rrrrrrr r"rrrrrr
r.s
rc@seZdZdZdS)�SAXNotRecognizedExceptionz�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.N�rrrrrrrr
r$isr$c@seZdZdZdS)�SAXNotSupportedExceptionaException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.Nr%rrrr
r&ssr&c@seZdZdZdS)�SAXReaderNotAvailableaException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.Nr%rrrr
r'}sr')
r�sys�platformZ	java.langrrrr$r&r'rrrr
�<module>s%;

__pycache__/handler.cpython-38.opt-1.pyc000064400000030210150346007760013764 0ustar00U

e5db6�@s�dZdZGdd�d�ZGdd�d�ZGdd�d�ZGdd	�d	�Zd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS)a0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
z2.0betac@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ErrorHandlera�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs|�dS)zHandle a recoverable error.N���selfZ	exceptionrr�'/usr/lib64/python3.8/xml/sax/handler.py�error szErrorHandler.errorcCs|�dS)zHandle a non-recoverable error.Nrrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dS)zHandle a warning.N)�printrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__�__doc__rrr	rrrrrs	rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ContentHandlerz�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS)N�Z_locator�rrrr�__init__6szContentHandler.__init__cCs
||_dS)a#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.Nr)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)z�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).Nrrrrr�
startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.Nrrrrr�endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.Nr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)z�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.Nr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdS)z�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.Nr�rrrrr�
endElement�szContentHandler.endElementcCsdS)a�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.Nr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdS)z�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.Nr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdS)a�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.Nr)rZcontentrrr�
characters�szContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.Nr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdS)a�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.Nr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.Nrrrrr�
skippedEntity�szContentHandler.skippedEntityN)r
rrr
rrrrrrrrrrr r!r$r%rrrrr/s	
rc@s eZdZdZdd�Zdd�ZdS)�
DTDHandlerz�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr'r(Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)r
rrr
r)r*rrrrr&�sr&c@seZdZdZdd�ZdS)�EntityResolvera7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S)z�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.r)rr'r(rrr�
resolveEntity�szEntityResolver.resolveEntityN)r
rrr
r,rrrrr+�sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r
�versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>s@
"��__pycache__/xmlreader.cpython-38.opt-2.pyc000064400000024251150346007770014344 0ustar00U

e5d�1�@s�ddlmZddlmZmZGdd�d�ZGdd�de�ZGdd�d�ZGd	d
�d
�ZGdd�d�Z	Gd
d�de	�Z
dd�Zedkr�e�dS)�)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �	XMLReadercCs,t��|_t��|_t��|_t��|_dS�N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler��self�r
�)/usr/lib64/python3.8/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS�Nz This method must be implemented!��NotImplementedError�r�sourcer
r
r�parseszXMLReader.parsecCs|jSr�rrr
r
r�getContentHandler"szXMLReader.getContentHandlercCs
||_dSrr�rrr
r
r�setContentHandler&szXMLReader.setContentHandlercCs|jSr�rrr
r
r�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dSrrrr
r
r�
setDTDHandler.szXMLReader.setDTDHandlercCs|jSr�r	rr
r
r�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dSrr)rZresolverr
r
r�setEntityResolver6szXMLReader.setEntityResolvercCs|jSr�r
rr
r
r�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dSrr rr
r
r�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)NzLocale support not implemented)r)rZlocaler
r
r�	setLocaleBszXMLReader.setLocalecCstd|��dS�NzFeature '%s' not recognized�r�r�namer
r
r�
getFeatureKszXMLReader.getFeaturecCstd|��dSr$r%)rr'�stater
r
r�
setFeatureOszXMLReader.setFeaturecCstd|��dS�NzProperty '%s' not recognizedr%r&r
r
r�getPropertySszXMLReader.getPropertycCstd|��dSr+r%)rr'�valuer
r
r�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__rrrrrrrrr!r"r#r(r*r,r.r
r
r
rrs
	rc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�IncrementalParser�cCs||_t�|�dSr)�_bufsizerr)r�bufsizer
r
rroszIncrementalParser.__init__cCslddlm}|�|�}|�|�|��}|dkr8|��}|�|j�}|r`|�|�|�|j�}qD|�	�dS)Nr)�saxutils)
�r6Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr4�feed�close)rrr6�file�bufferr
r
rrss


zIncrementalParser.parsecCstd��dSrr)r�datar
r
rr<�szIncrementalParser.feedcCstd��dS)Nz!prepareParser must be overridden!rrr
r
rr8�szIncrementalParser.prepareParsercCstd��dSrrrr
r
rr=�szIncrementalParser.closecCstd��dSrrrr
r
r�reset�szIncrementalParser.resetN)r3)	r/r0r1rrr<r8r=rAr
r
r
rr2[s
	
r2c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LocatorcCsdS�N���r
rr
r
r�getColumnNumber�szLocator.getColumnNumbercCsdSrCr
rr
r
r�
getLineNumber�szLocator.getLineNumbercCsdSrr
rr
r
r�getPublicId�szLocator.getPublicIdcCsdSrr
rr
r
r�getSystemId�szLocator.getSystemIdN)r/r0r1rErFrGrHr
r
r
rrB�srBc@sfeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�InputSourceNcCs"||_d|_d|_d|_d|_dSr)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile�rZ	system_idr
r
rr�s
zInputSource.__init__cCs
||_dSr�rK)rZ	public_idr
r
r�setPublicId�szInputSource.setPublicIdcCs|jSrrPrr
r
rrG�szInputSource.getPublicIdcCs
||_dSr�rJrOr
r
r�setSystemId�szInputSource.setSystemIdcCs|jSrrRrr
r
rrH�szInputSource.getSystemIdcCs
||_dSr�rL)r�encodingr
r
r�setEncoding�szInputSource.setEncodingcCs|jSrrTrr
r
r�getEncoding�szInputSource.getEncodingcCs
||_dSr�rM)rZbytefiler
r
r�
setByteStream�szInputSource.setByteStreamcCs|jSrrXrr
r
rr:�szInputSource.getByteStreamcCs
||_dSr�rN)rZcharfiler
r
r�setCharacterStreamszInputSource.setCharacterStreamcCs|jSrrZrr
r
rr9szInputSource.getCharacterStream)N)r/r0r1rrQrGrSrHrVrWrYr:r[r9r
r
r
rrI�s



rIc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dSr��_attrs)r�attrsr
r
rrszAttributesImpl.__init__cCs
t|j�Sr��lenr^rr
r
r�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr
r&r
r
r�getType!szAttributesImpl.getTypecCs
|j|Srr]r&r
r
r�getValue$szAttributesImpl.getValuecCs
|j|Srr]r&r
r
r�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|Sr�r^�KeyErrorr&r
r
r�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|Srrfr&r
r
r�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|j���Sr��listr^�keysrr
r
r�getNames4szAttributesImpl.getNamescCst|j���Srrjrr
r
r�	getQNames7szAttributesImpl.getQNamescCs
t|j�Srr`rr
r
r�__len__:szAttributesImpl.__len__cCs
|j|Srr]r&r
r
r�__getitem__=szAttributesImpl.__getitem__cCst|j���Srrjrr
r
rrl@szAttributesImpl.keyscCs
||jkSrr]r&r
r
r�__contains__CszAttributesImpl.__contains__NcCs|j�||�Sr)r^�get)rr'�alternativer
r
rrrFszAttributesImpl.getcCs|�|j�Sr)�	__class__r^rr
r
r�copyIszAttributesImpl.copycCst|j���Sr)rkr^�itemsrr
r
rrvLszAttributesImpl.itemscCst|j���Sr)rkr^�valuesrr
r
rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr
r
r
rr\s"
r\c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dSr)r^�_qnames)rr_Zqnamesr
r
rrVszAttributesNSImpl.__init__cCs6|j��D]\}}||kr
|j|Sq
t|��dSr)ryrvr^rg�rr'ZnsnameZqnamer
r
rre^sz AttributesNSImpl.getValueByQNamecCs0|j��D]\}}||kr
|Sq
t|��dSr)ryrvrgrzr
r
rrhes
zAttributesNSImpl.getNameByQNamecCs
|j|Sr)ryr&r
r
rrilszAttributesNSImpl.getQNameByNamecCst|j���Sr)rkryrwrr
r
rrnoszAttributesNSImpl.getQNamescCs|�|j|j�Sr)rtr^ryrr
r
rrurszAttributesNSImpl.copyN)	r/r0r1rrerhrirnrur
r
r
rrxTsrxcCst�t�t�dSr)rr2rBr
r
r
r�_testvsr{�__main__N)
r7r�_exceptionsrrrr2rBrIr\rxr{r/r
r
r
r�<module>sPJY>"__pycache__/saxutils.cpython-38.pyc000064400000031171150346007770013274 0ustar00U

e5d�/�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	dd�Z
ifdd	�Zifd
d�Zifdd
�Z
dd�ZGdd�dej�ZGdd�de	j�Zddd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreadercCs"|��D]\}}|�||�}q|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.8/xml/sax/saxutils.py�__dict_replacesr
cCs6|�dd�}|�dd�}|�dd�}|r2t||�}|S)z�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    �&�&amp;�>�&gt;�<�&lt;�rr
��dataZentitiesrrr�escapes	
rcCs2|�dd�}|�dd�}|r&t||�}|�dd�S)a
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    rrrrrrrrrrr�unescape"s

rcCsR|dddd��}t||�}d|krFd|kr<d|�dd�}qNd	|}nd|}|S)
a�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')rrrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDt�
�}dd�|_�j|_z�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S�N)�getattr��self�name��outrr�__getattr__Zsz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r&rr$rr�_wrapperXsr+cSsdSrrrrrr�<lambda>]�z _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrrr,br-�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r%r/r3r+�bufferrr$r�_gettextwriterGs0
�rEc@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtj�|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)N���F)r�ContentHandler�__init__rEr?�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r"r%r/Zshort_empty_elementsrrrrJrs
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rO)r"r#�prefixrrr�_qname~szXMLGenerator._qnamecCs|jr|�d�d|_dS)NrF�rSrK)r"�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|�d|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rKrQ�r"rrr�
startDocument�s�zXMLGenerator.startDocumentcCs|��dSr)rMrZrrr�endDocument�szXMLGenerator.endDocumentcCs0|j�|j���||j|<|j�||f�dSr)rN�appendrO�copyrP�r"rU�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrO�r"rUrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCsZ|��|�d|�|��D]\}}|�d|t|�f�q|jrLd|_n
|�d�dS)Nr� %s=%sTr)rYrKrrrRrS)r"r#�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|�d�d|_n|�d|�dS�Nz/>Fz</%s>rWr!rrrrX�s
zXMLGenerator.endElementcCs�|��|�d|�|��|jD].\}}|rB|�d||f�q"|�d|�q"g|_|��D]$\}}|�d|�|�t|�f�q`|jr�d|_n
|�d�dS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#�qnamererUr`r
rrr�startElementNS�szXMLGenerator.startElementNScCs0|jr|�d�d|_n|�d|�|��dSrg)rSrKrV�r"r#rhrrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|��t|t�s"t||j�}|�t|��dSr)rYr5�strrQrKr�r"Zcontentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|��t|t�s"t||j�}|�|�dSr)rYr5rlrQrKrmrrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|��|�d||f�dS)Nz	<?%s %s?>)rYrK�r"�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrrrrrrFps


rFc@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)<�
XMLFilterBaseaYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.NcCstj�|�||_dSr)r�	XMLReaderrJ�_parent�r"�parentrrrrJ�szXMLFilterBase.__init__cCs|j�|�dSr)�_err_handler�error�r"Z	exceptionrrrry�szXMLFilterBase.errorcCs|j�|�dSr)rx�
fatalErrorrzrrrr{�szXMLFilterBase.fatalErrorcCs|j�|�dSr)rx�warningrzrrrr|�szXMLFilterBase.warningcCs|j�|�dSr)�
_cont_handler�setDocumentLocator)r"Zlocatorrrrr~�sz XMLFilterBase.setDocumentLocatorcCs|j��dSr)r}r[rZrrrr[�szXMLFilterBase.startDocumentcCs|j��dSr)r}r\rZrrrr\szXMLFilterBase.endDocumentcCs|j�||�dSr)r}rar_rrrrasz XMLFilterBase.startPrefixMappingcCs|j�|�dSr)r}rcrbrrrrcszXMLFilterBase.endPrefixMappingcCs|j�||�dSr)r}rf)r"r#rerrrrfszXMLFilterBase.startElementcCs|j�|�dSr)r}rXr!rrrrXszXMLFilterBase.endElementcCs|j�|||�dSr)r}ri)r"r#rhrerrrriszXMLFilterBase.startElementNScCs|j�||�dSr)r}rkrjrrrrkszXMLFilterBase.endElementNScCs|j�|�dSr)r}rnrmrrrrnszXMLFilterBase.characterscCs|j�|�dSr)r}ro)r"�charsrrrrosz!XMLFilterBase.ignorableWhitespacecCs|j�||�dSr)r}rrrprrrrrsz#XMLFilterBase.processingInstructioncCs|j�|�dSr)r}�
skippedEntityr!rrrr� szXMLFilterBase.skippedEntitycCs|j�|||�dSr)�_dtd_handler�notationDecl)r"r#�publicId�systemIdrrrr�%szXMLFilterBase.notationDeclcCs|j�||||�dSr)r��unparsedEntityDecl)r"r#r�r�Zndatarrrr�(sz XMLFilterBase.unparsedEntityDeclcCs|j�||�Sr)Z_ent_handler�
resolveEntity)r"r�r�rrrr�-szXMLFilterBase.resolveEntitycCs@|j�|�|j�|�|j�|�|j�|�|j�|�dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r"�sourcerrrr�2s
zXMLFilterBase.parsecCs|j�|�dSr)ru�	setLocale)r"Zlocalerrrr�9szXMLFilterBase.setLocalecCs|j�|�Sr)ru�
getFeaturer!rrrr�<szXMLFilterBase.getFeaturecCs|j�||�dSr)ru�
setFeature)r"r#�staterrrr�?szXMLFilterBase.setFeaturecCs|j�|�Sr)ru�getPropertyr!rrrr�BszXMLFilterBase.getPropertycCs|j�||�dSr)ru�setProperty)r"r#r
rrrr�EszXMLFilterBase.setPropertycCs|jSr�rurZrrr�	getParentJszXMLFilterBase.getParentcCs
||_dSrr�rvrrr�	setParentMszXMLFilterBase.setParent)N) r'r(r)�__doc__rJryr{r|r~r[r\rarcrfrXrirkrnrorrr�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�s:
rs�cCs$t|tj�rt�|�}t|t�r,t�|�}n^t|d�r�|}t��}t|�d�t�r^|�	|�n
|�
|�t|d�r�t|jt�r�|�|j�|�
�dk�r |��dk�r |��}tj�tj�|��}tj�||�}tj�|�r�|�|�t|d�}n$|�tj�||��tj�|���}|�
|�|S)z�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.�readrr#N�rb)r5�os�PathLike�fspathrlrZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamr#ZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�path�dirname�normpath�join�isfile�open�urllibr�ZurljoinZrequestZurlopen)r��base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceRs.





r�)r�)r�r�Zurllib.parser�Zurllib.requestr6r8r�rrr
rrrrErIrFrtrsr�rrrr�<module>s)so__pycache__/handler.cpython-38.opt-2.pyc000064400000011055150346007770013774 0ustar00U

e5db6�@s�dZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zd	Zd
ZdZdZd
Z	dZ
eeeee	e
gZdZdZ
dZdZdZdZeee
eeegZdS)z2.0betac@s$eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCs|�dS�N���selfZ	exceptionrr�'/usr/lib64/python3.8/xml/sax/handler.py�error szErrorHandler.errorcCs|�dSrrrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dSr)�printrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__rrr
rrrrrs
rc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ContentHandlercCs
d|_dSr�Z_locator�rrrr�__init__6szContentHandler.__init__cCs
||_dSrr)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdSrrrrrr�
startDocumentPszContentHandler.startDocumentcCsdSrrrrrr�endDocumentWszContentHandler.endDocumentcCsdSrr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdSrr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdSrr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdSrr�rrrrr�
endElement�szContentHandler.endElementcCsdSrr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdSrr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdSrr)rZcontentrrr�
characters�szContentHandler.characterscCsdSrr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdSrr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdSrrrrrr�
skippedEntity�szContentHandler.skippedEntityN)rrr
rrrrrrrrrrr r!r$r%rrrrr/s	
rc@seZdZdd�Zdd�ZdS)�
DTDHandlercCsdSrr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdSrr)rrr'r(Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)rrr
r)r*rrrrr&�sr&c@seZdZdd�ZdS)�EntityResolvercCs|Srr)rr'r(rrr�
resolveEntity�szEntityResolver.resolveEntityN)rrr
r,rrrrr+�sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)�versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>s>
"��__pycache__/saxutils.cpython-38.opt-2.pyc000064400000026002150346007770014231 0ustar00U

e5d�/�@s�ddlZddlZddlZddlZddlZddlmZddlmZdd�Z	ifdd�Z
ifd	d
�Zifdd�Zd
d�Z
Gdd�dej�ZGdd�dej�Zddd�ZdS)�N�)�handler)�	xmlreadercCs"|��D]\}}|�||�}q|S�N)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.8/xml/sax/saxutils.py�__dict_replacesrcCs6|�dd�}|�dd�}|�dd�}|r2t||�}|S)N�&�&amp;�>�&gt;�<�&lt;�rr��dataZentitiesrrr
�escapes	
rcCs2|�dd�}|�dd�}|r&t||�}|�dd�S)Nrrrrrrrrrrr
�unescape"s

rcCsR|dddd��}t||�}d|krFd|kr<d|�dd�}qNd	|}nd|}|S)
Nz&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')rrrrrr
�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDt�
�}dd�|_�j|_z�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�Sr)�getattr��self�name��outrr
�__getattr__Zsz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r&rr$rr
�_wrapperXsr+cSsdSrrrrrr
�<lambda>]�z _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrr
r,br-�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r%r/r3r+�bufferrr$r
�_gettextwriterGs0
�rEc@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtj�|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)N���F)r�ContentHandler�__init__rEr?�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r"r%r/Zshort_empty_elementsrrr
rJrs
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rO)r"r#�prefixrrr
�_qname~szXMLGenerator._qnamecCs|jr|�d�d|_dS)NrF�rSrK)r"�
endElementrrr
�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|�d|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rKrQ�r"rrr
�
startDocument�s�zXMLGenerator.startDocumentcCs|��dSr)rMrZrrr
�endDocument�szXMLGenerator.endDocumentcCs0|j�|j���||j|<|j�||f�dSr)rN�appendrO�copyrP�r"rU�urirrr
�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrO�r"rUrrr
�endPrefixMapping�szXMLGenerator.endPrefixMappingcCsZ|��|�d|�|��D]\}}|�d|t|�f�q|jrLd|_n
|�d�dS)Nr� %s=%sTr)rYrKrrrRrS)r"r#�attrsrrrr
�startElement�szXMLGenerator.startElementcCs*|jr|�d�d|_n|�d|�dS�Nz/>Fz</%s>rWr!rrr
rX�s
zXMLGenerator.endElementcCs�|��|�d|�|��|jD].\}}|rB|�d||f�q"|�d|�q"g|_|��D]$\}}|�d|�|�t|�f�q`|jr�d|_n
|�d�dS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#�qnamererUr`rrrr
�startElementNS�szXMLGenerator.startElementNScCs0|jr|�d�d|_n|�d|�|��dSrg)rSrKrV�r"r#rhrrr
�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|��t|t�s"t||j�}|�t|��dSr)rYr5�strrQrKr�r"Zcontentrrr
�
characters�s

zXMLGenerator.characterscCs0|r,|��t|t�s"t||j�}|�|�dSr)rYr5rlrQrKrmrrr
�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|��|�d||f�dS)Nz	<?%s %s?>)rYrK�r"�targetrrrr
�processingInstruction�sz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrrrrr
rFps


rFc@s�eZdZd:dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS);�
XMLFilterBaseNcCstj�|�||_dSr)r�	XMLReaderrJ�_parent�r"�parentrrr
rJ�szXMLFilterBase.__init__cCs|j�|�dSr)�_err_handler�error�r"Z	exceptionrrr
ry�szXMLFilterBase.errorcCs|j�|�dSr)rx�
fatalErrorrzrrr
r{�szXMLFilterBase.fatalErrorcCs|j�|�dSr)rx�warningrzrrr
r|�szXMLFilterBase.warningcCs|j�|�dSr)�
_cont_handler�setDocumentLocator)r"Zlocatorrrr
r~�sz XMLFilterBase.setDocumentLocatorcCs|j��dSr)r}r[rZrrr
r[�szXMLFilterBase.startDocumentcCs|j��dSr)r}r\rZrrr
r\szXMLFilterBase.endDocumentcCs|j�||�dSr)r}rar_rrr
rasz XMLFilterBase.startPrefixMappingcCs|j�|�dSr)r}rcrbrrr
rcszXMLFilterBase.endPrefixMappingcCs|j�||�dSr)r}rf)r"r#rerrr
rfszXMLFilterBase.startElementcCs|j�|�dSr)r}rXr!rrr
rXszXMLFilterBase.endElementcCs|j�|||�dSr)r}ri)r"r#rhrerrr
riszXMLFilterBase.startElementNScCs|j�||�dSr)r}rkrjrrr
rkszXMLFilterBase.endElementNScCs|j�|�dSr)r}rnrmrrr
rnszXMLFilterBase.characterscCs|j�|�dSr)r}ro)r"�charsrrr
rosz!XMLFilterBase.ignorableWhitespacecCs|j�||�dSr)r}rrrprrr
rrsz#XMLFilterBase.processingInstructioncCs|j�|�dSr)r}�
skippedEntityr!rrr
r� szXMLFilterBase.skippedEntitycCs|j�|||�dSr)�_dtd_handler�notationDecl)r"r#�publicId�systemIdrrr
r�%szXMLFilterBase.notationDeclcCs|j�||||�dSr)r��unparsedEntityDecl)r"r#r�r�Zndatarrr
r�(sz XMLFilterBase.unparsedEntityDeclcCs|j�||�Sr)Z_ent_handler�
resolveEntity)r"r�r�rrr
r�-szXMLFilterBase.resolveEntitycCs@|j�|�|j�|�|j�|�|j�|�|j�|�dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r"�sourcerrr
r�2s
zXMLFilterBase.parsecCs|j�|�dSr)ru�	setLocale)r"Zlocalerrr
r�9szXMLFilterBase.setLocalecCs|j�|�Sr)ru�
getFeaturer!rrr
r�<szXMLFilterBase.getFeaturecCs|j�||�dSr)ru�
setFeature)r"r#�staterrr
r�?szXMLFilterBase.setFeaturecCs|j�|�Sr)ru�getPropertyr!rrr
r�BszXMLFilterBase.getPropertycCs|j�||�dSr)ru�setProperty)r"r#rrrr
r�EszXMLFilterBase.setPropertycCs|jSr�rurZrrr
�	getParentJszXMLFilterBase.getParentcCs
||_dSrr�rvrrr
�	setParentMszXMLFilterBase.setParent)N)r'r(r)rJryr{r|r~r[r\rarcrfrXrirkrnrorrr�r�r�r�r�r�r�r�r�r�r�r�rrrr
rs�s8
rs�cCs$t|tj�rt�|�}t|t�r,t�|�}n^t|d�r�|}t��}t|�d�t�r^|�	|�n
|�
|�t|d�r�t|jt�r�|�|j�|�
�dk�r |��dk�r |��}tj�tj�|��}tj�||�}tj�|�r�|�|�t|d�}n$|�tj�||��tj�|���}|�
|�|S)N�readrr#�rb)r5�os�PathLike�fspathrlrZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamr#ZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�path�dirname�normpath�join�isfile�open�urllibr�ZurljoinZrequestZurlopen)r��base�fZsysidZbaseheadZ
sysidfilenamerrr
�prepare_input_sourceRs.





r�)r�)r�Zurllib.parser�Zurllib.requestr6r8r�rrrrrrrErIrFrtrsr�rrrr
�<module>s)so__pycache__/handler.cpython-38.pyc000064400000030210150346007770013026 0ustar00U

e5db6�@s�dZdZGdd�d�ZGdd�d�ZGdd�d�ZGdd	�d	�Zd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS)a0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
z2.0betac@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ErrorHandlera�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs|�dS)zHandle a recoverable error.N���selfZ	exceptionrr�'/usr/lib64/python3.8/xml/sax/handler.py�error szErrorHandler.errorcCs|�dS)zHandle a non-recoverable error.Nrrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dS)zHandle a warning.N)�printrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__�__doc__rrr	rrrrrs	rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ContentHandlerz�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS)N�Z_locator�rrrr�__init__6szContentHandler.__init__cCs
||_dS)a#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.Nr)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)z�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).Nrrrrr�
startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.Nrrrrr�endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.Nr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)z�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.Nr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdS)z�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.Nr�rrrrr�
endElement�szContentHandler.endElementcCsdS)a�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.Nr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdS)z�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.Nr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdS)a�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.Nr)rZcontentrrr�
characters�szContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.Nr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdS)a�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.Nr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.Nrrrrr�
skippedEntity�szContentHandler.skippedEntityN)r
rrr
rrrrrrrrrrr r!r$r%rrrrr/s	
rc@s eZdZdZdd�Zdd�ZdS)�
DTDHandlerz�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr'r(Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)r
rrr
r)r*rrrrr&�sr&c@seZdZdZdd�ZdS)�EntityResolvera7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S)z�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.r)rr'r(rrr�
resolveEntity�szEntityResolver.resolveEntityN)r
rrr
r,rrrrr+�sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r
�versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>s@
"��__pycache__/xmlreader.cpython-38.opt-1.pyc000064400000040716150346007770014347 0ustar00U

e5d�1�@s�dZddlmZddlmZmZGdd�d�ZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
Gdd�de
�Zdd�Ze
dkr�e�dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�	XMLReadera%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs,t��|_t��|_t��|_t��|_dS�N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler��self�r
�)/usr/lib64/python3.8/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS)zAParse an XML document from a system identifier or an InputSource.� This method must be implemented!N��NotImplementedError�r�sourcer
r
r�parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.�rrr
r
r�getContentHandler"szXMLReader.getContentHandlercCs
||_dS)z:Registers a new object to receive document content events.Nr�rrr
r
r�setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.�rrr
r
r�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dS)z7Register an object to receive basic DTD-related events.Nrrr
r
r�
setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.�r	rr
r
r�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dS)z0Register an object to resolve external entities.Nr)rZresolverr
r
r�setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.�r
rr
r
r�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dS)z3Register an object to receive error-message events.Nr rr
r
r�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)aHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.zLocale support not implementedN)r)rZlocaler
r
r�	setLocaleBszXMLReader.setLocalecCstd|��dS)z1Looks up and returns the state of a SAX2 feature.�Feature '%s' not recognizedN�r�r�namer
r
r�
getFeatureKszXMLReader.getFeaturecCstd|��dS)z!Sets the state of a SAX2 feature.r$Nr%)rr'�stater
r
r�
setFeatureOszXMLReader.setFeaturecCstd|��dS)z2Looks up and returns the value of a SAX2 property.�Property '%s' not recognizedNr%r&r
r
r�getPropertySszXMLReader.getPropertycCstd|��dS)z"Sets the value of a SAX2 property.r+Nr%)rr'�valuer
r
r�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr!r"r#r(r*r,r.r
r
r
rrs 	rc@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�IncrementalParserasThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.�cCs||_t�|�dSr)�_bufsizerr)r�bufsizer
r
rroszIncrementalParser.__init__cCslddlm}|�|�}|�|�|��}|dkr8|��}|�|j�}|r`|�|�|�|j�}qD|�	�dS)Nr)�saxutils)
�r7Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr5�feed�close)rrr7�file�bufferr
r
rrss


zIncrementalParser.parsecCstd��dS)aThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.rNr)r�datar
r
rr=�szIncrementalParser.feedcCstd��dS)ztThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!Nrrr
r
rr9�szIncrementalParser.prepareParsercCstd��dS)a�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.rNrrr
r
rr>�szIncrementalParser.closecCstd��dS)z�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.rNrrr
r
r�reset�szIncrementalParser.resetN)r4)
r/r0r1r2rrr=r9r>rBr
r
r
rr3[s
	
r3c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Locatorz�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS)z6Return the column number where the current event ends.���r
rr
r
r�getColumnNumber�szLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rDr
rr
r
r�
getLineNumber�szLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr
rr
r
r�getPublicId�szLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr
rr
r
r�getSystemId�szLocator.getSystemIdN)r/r0r1r2rErFrGrHr
r
r
rrC�s
rCc@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�InputSourceanEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dSr)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile�rZ	system_idr
r
rr�s
zInputSource.__init__cCs
||_dS)z/Sets the public identifier of this InputSource.N�rK)rZ	public_idr
r
r�setPublicId�szInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.rPrr
r
rrG�szInputSource.getPublicIdcCs
||_dS)z/Sets the system identifier of this InputSource.N�rJrOr
r
r�setSystemId�szInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.rRrr
r
rrH�szInputSource.getSystemIdcCs
||_dS)a4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N�rL)r�encodingr
r
r�setEncoding�szInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.rTrr
r
r�getEncoding�szInputSource.getEncodingcCs
||_dS)a�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N�rM)rZbytefiler
r
r�
setByteStream�szInputSource.setByteStreamcCs|jS)z�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.rXrr
r
rr;�szInputSource.getByteStreamcCs
||_dS)a^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N�rN)rZcharfiler
r
r�setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.rZrr
r
rr:szInputSource.getCharacterStream)N)r/r0r1r2rrQrGrSrHrVrWrYr;r[r:r
r
r
rrI�s



rIc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dS)zQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N��_attrs)r�attrsr
r
rrszAttributesImpl.__init__cCs
t|j�Sr��lenr^rr
r
r�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr
r&r
r
r�getType!szAttributesImpl.getTypecCs
|j|Srr]r&r
r
r�getValue$szAttributesImpl.getValuecCs
|j|Srr]r&r
r
r�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|Sr�r^�KeyErrorr&r
r
r�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|Srrfr&r
r
r�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|j���Sr��listr^�keysrr
r
r�getNames4szAttributesImpl.getNamescCst|j���Srrjrr
r
r�	getQNames7szAttributesImpl.getQNamescCs
t|j�Srr`rr
r
r�__len__:szAttributesImpl.__len__cCs
|j|Srr]r&r
r
r�__getitem__=szAttributesImpl.__getitem__cCst|j���Srrjrr
r
rrl@szAttributesImpl.keyscCs
||jkSrr]r&r
r
r�__contains__CszAttributesImpl.__contains__NcCs|j�||�Sr)r^�get)rr'�alternativer
r
rrrFszAttributesImpl.getcCs|�|j�Sr)�	__class__r^rr
r
r�copyIszAttributesImpl.copycCst|j���Sr)rkr^�itemsrr
r
rrvLszAttributesImpl.itemscCst|j���Sr)rkr^�valuesrr
r
rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr
r
r
rr\s"
r\c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dS)z�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N)r^�_qnames)rr_Zqnamesr
r
rrVszAttributesNSImpl.__init__cCs6|j��D]\}}||kr
|j|Sq
t|��dSr)ryrvr^rg�rr'ZnsnameZqnamer
r
rre^sz AttributesNSImpl.getValueByQNamecCs0|j��D]\}}||kr
|Sq
t|��dSr)ryrvrgrzr
r
rrhes
zAttributesNSImpl.getNameByQNamecCs
|j|Sr)ryr&r
r
rrilszAttributesNSImpl.getQNameByNamecCst|j���Sr)rkryrwrr
r
rrnoszAttributesNSImpl.getQNamescCs|�|j|j�Sr)rtr^ryrr
r
rrurszAttributesNSImpl.copyN)	r/r0r1rrerhrirnrur
r
r
rrxTsrxcCst�t�t�dSr)rr3rCr
r
r
r�_testvsr{�__main__N)r2r8r�_exceptionsrrrr3rCrIr\rxr{r/r
r
r
r�<module>sPJY>"__pycache__/__init__.cpython-38.pyc000064400000006225150346007770013161 0ustar00U

e5d?�@s
dZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�fdd�Ze�fdd�Z
d	gZd
Zernd
dlZd
dlZd
dlZejjs�dejkr�ejd�d
�Z[dZejdd�dkr�ej�e�r�ej�e��d
�Zddd�Zejdd�dkr�dd�Zndd�Z[dS)a�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|�|�|�|�|�|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.8/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|�|�|�|�t�}t|t�rR|�|�	|��n|�
|�|��|�|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javarcCsxt|�tD]\}zt|�WStk
rT}zddl}||jkrD�W5d}~XYqtk
rfYqXqtdd��dS)a3Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the iterable created by chaining parser_list and
    default_parser_list.  The iterables must contain the names of Python
    modules containing both a SAX parser and a create_parser function.rNzNo parsers found)�list�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er#rrrr
Fs
r
cCs$ddlm}|�|dt��}|��S)Nr)�imp)Zorg.python.corer'Z
importName�globals�
create_parser)r%r'�
drv_modulerrrr!asr!cCst|iidg�}|��S)Nr))�
__import__r))r%r*rrrr!gs)r)�__doc__Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr �_falseZxml.sax.expatreaderZxml�osr#�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r!rrrr�<module>s*

__pycache__/handler.cpython-36.opt-1.pyc000064400000030033150347611750013766 0ustar003


 \b6�@s�dZdZGdd�d�ZGdd�d�ZGdd�d�ZGdd	�d	�Zd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS)a0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
z2.0betac@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ErrorHandlera�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs|�dS)zHandle a recoverable error.N�)�self�	exceptionrr�'/usr/lib64/python3.6/xml/sax/handler.py�error szErrorHandler.errorcCs|�dS)zHandle a non-recoverable error.Nr)rrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dS)zHandle a warning.N)�print)rrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__�__doc__rrr	rrrrrsrc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ContentHandlerz�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS)N)�_locator)rrrr�__init__6szContentHandler.__init__cCs
||_dS)a#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.N)r)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)z�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).Nr)rrrr�
startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.Nr)rrrr�endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.Nr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)z�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.Nr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdS)z�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.Nr)rrrrr�
endElement�szContentHandler.endElementcCsdS)a�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.Nr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdS)z�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.Nr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdS)a�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.Nr)rZcontentrrr�
characters�szContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.Nr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdS)a�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.Nr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.Nr)rrrrr�
skippedEntity�szContentHandler.skippedEntityN)r
rrr
rrrrrrrrrrrrr"r#rrrrr/s	
rc@s eZdZdZdd�Zdd�ZdS)�
DTDHandlerz�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)r
rrr
r'r(rrrrr$�sr$c@seZdZdZdd�ZdS)�EntityResolvera7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S)z�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.r)rr%r&rrr�
resolveEntity�szEntityResolver.resolveEntityN)r
rrr
r*rrrrr)�sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r
�versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>
s<
"	__pycache__/_exceptions.cpython-36.opt-1.pyc000064400000012533150347611750014676 0ustar003


 \��@s�dZddlZejdd�dkr*ddlmZ[Gdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z	dS)z!Different kinds of SAX Exceptions�N��java)�	Exceptionc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�SAXExceptiona�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.NcCs||_||_tj||�dS)zUCreates an exception. The message is required, but the exception
        is optional.N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r�+/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r	rrr
�
getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r	rrr
�getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r	rrr
�__str__"szSAXException.__str__cCstd��dS)zvAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.�__getitem__N)�AttributeError)r	Zixrrr
r&szSAXException.__getitem__)N)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
r	s
rc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�SAXParseExceptiona#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCs<tj|||�||_|jj�|_|jj�|_|jj�|_dS)zECreates the exception. The exception parameter is allowed to be None.N)	rr�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r	r
rZlocatorrrr
r;s
zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception
        occurred.)r)r	rrr
rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r	rrr
rMszSAXParseException.getLineNumbercCs
|jj�S)zEGet the public identifier of the entity where the exception occurred.)r�getPublicId)r	rrr
rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r	rrr
rUszSAXParseException.getSystemIdcCsN|j�}|dkrd}|j�}|dkr(d}|j�}|dkr<d}d||||jfS)z0Create a string representation of the exception.Nz	<unknown>�?z%s:%s:%s: %s)rrrr)r	ZsysidZlinenumZcolnumrrr
rYszSAXParseException.__str__N)
rrrrrrrrrrrrrr
r.s
rc@seZdZdZdS)�SAXNotRecognizedExceptionz�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.N)rrrrrrrr
r!isr!c@seZdZdZdS)�SAXNotSupportedExceptionaException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.N)rrrrrrrr
r"ssr"c@seZdZdZdS)�SAXReaderNotAvailableaException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.N)rrrrrrrr
r#}sr#)
r�sys�platformZ	java.langrrrr!r"r#rrrr
�<module>s%;

__pycache__/expatreader.cpython-36.opt-1.pyc000064400000030153150347611750014660 0ustar003


 \X=�@s�dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d	d
�dkr|edd	��[ydd
lmZWnek
r�edd	��YnXeed�s�edd	��ddlmZmZmZejZejZydd	lZWnek
�rdd�ZYnXdd	lZejZ[[Gdd�d�ZGdd�dej�ZGdd�dej ej�Z!dd�Z"e#dk�r�dd	l$Z%e"�Z&e&j'e%j(jj)��e&j*e%j(j+��e&j,d�d	S)z]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S)N�)�orr�+/usr/lib64/python3.6/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ExpatLocatorz�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dS)N)r�_ref)�self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r�_parser�ErrorColumnNumber)rrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N�)rr�ErrorLineNumber)rrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|jj�S)N)r�_source�getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jj�S)N)rr%�getSystemId)rrrrrr'NszExpatLocator.getSystemIdN)	rrr�__doc__rr!r$r&r'rrrrr3src@seZdZdZdGdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�ZdHdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDS)I�ExpatParserz$SAX driver for the pyexpat C module.r���cCsFtjj||�tj�|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserrZInputSourcer%r�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrrZs
zExpatParser.__init__c	CsVtj|�}||_y*|j�|jjt|��tjj	||�Wn|j
��YnXdS)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer%�reset�
_cont_handlerZsetDocumentLocatorrrr-�parse�
_close_source)r�sourcerrrr8gs
zExpatParser.parsecCs |j�dk	r|jj|j��dS)N)r'rZSetBase)rr:rrr�
prepareParserwszExpatParser.prepareParsercCs tjj||�|jr|j�dS)N)rr-�setContentHandlerr0�_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)NrzFeature '%s' not recognized)
rr.rr3rrrrr2�SAXNotRecognizedException)r�namerrr�
getFeature�s
zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized)r0�SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?�staterrr�
setFeature�s2
zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|jj�St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized)r�property_lexical_handlerr/r
r3r	r�hasattrrDr>rA)rr?rrr�getProperty�s

zExpatParser.getPropertycCsV|tjkr ||_|jrR|j�n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setzProperty '%s' not recognized)
rrEr/r0�_reset_lex_handler_propr
r3r	rAr>)rr?�valuerrr�setProperty�s


zExpatParser.setPropertycCsz|js|j�d|_|jj�y|jj||�WnDtjk
rt}z&ttj	|j
�||�}|jj|�WYdd}~XnXdS)Nr")
r0r6r7Z
startDocumentrZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|j�}|dk	r |j�Wd|j�}|dk	r<|j�XdS)N)r%ZgetCharacterStream�closeZ
getByteStream)rr:�filerrrr9�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|jj�d|_d|_Wdd|_|jdk	rzt�}|jj|_|jj	|_	||_|j
�XdS)N�r")rNr)r1r�
isinstancerrQr7ZendDocumentr0r r#r9)rrrrrrR�s




zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7�processingInstructionrZProcessingInstructionHandler�
charactersZCharacterDataHandler)rrrrr=�szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dS)N)r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|jj�d|jd�|_d|j_|j|j_	|j
|j_n,tj|jj�|jd�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr�|j�|j|j_y|j|j_Wntk
r�YnX|jjtj �d|_!g|_"dS)N� )�internr"r)#r.r
rr%ZgetEncodingr3rZnamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr=�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rH�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6







zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s
zExpatParser.getLineNumbercCs
|jj�S)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs
|jj�S)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|��dS)N)r7ZstartElement�AttributesImpl)rr?�attrsrrrr]LszExpatParser.start_elementcCs|jj|�dS)N)r7Z
endElement)rr?rrrr^OszExpatParser.end_elementcCs�|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}x�|j�D]|\}}|j�}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qVW|jj|dt||��dS)Nr"�rz%s:%sr*)�split�len�tuple�itemsr7ZstartElementNS�AttributesNSImpl)rr?rg�pairZnewattrsZqnamesZanamerI�partsZlengthZqnameZapairrrrr[Rs.


zExpatParser.start_element_nscCsV|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|jj|d�dS)Nr"rhr)rirjrkr7ZendElementNS)rr?rnrrrr\ts
zExpatParser.end_element_nscCs|jj||�dS)N)r7rV)r�targetrMrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|jj|�dS)N)r7rW)rrMrrr�character_data�szExpatParser.character_datacCs|jj||�dS)N)r7ZstartPrefixMapping)r�prefixZurirrrra�sz ExpatParser.start_namespace_declcCs|jj|�dS)N)r7ZendPrefixMapping)rrsrrrrb�szExpatParser.end_namespace_declcCs|jj|||�dS)N)r/ZstartDTD)rr?�sysid�pubidZhas_internal_subsetrrrrX�szExpatParser.start_doctype_declcCs|jj||||�dS)N)�_dtd_handlerZunparsedEntityDecl)rr?�basertruZ
notation_namerrrr_�sz ExpatParser.unparsed_entity_declcCs|jj|||�dS)N)rvZnotationDecl)rr?rwrtrurrrr`�szExpatParser.notation_declc	Cs�|js
dS|jj||�}tj||jj�p*d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�Wn
dS|jd\|_	|_|jd=dS)Nr"rTr���rx)r2Z_ent_handlerZ
resolveEntityrr5r%r'r1�appendrZExternalEntityParserCreaterr-r8)r�contextrwrtrur:rrrrc�s 
zExpatParser.external_entity_refcCs|rd|}|jj|�dS)N�%)r7Z
skippedEntity)rr?Zis_perrrrd�sz"ExpatParser.skipped_entity_handlerNi��)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@


'"r)cOs
t||�S)N)r))�args�kwargsrrr�
create_parser�sr�__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrFZxml.saxrrrrfrm�_weakrefr�weakref�proxyrZLocatorrr-r)rrZxml.sax.saxutilsZxml�pr<ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr8rrrr�<module>sN


$_
__pycache__/handler.cpython-36.pyc000064400000030033150347611750013027 0ustar003


 \b6�@s�dZdZGdd�d�ZGdd�d�ZGdd�d�ZGdd	�d	�Zd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS)a0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
z2.0betac@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ErrorHandlera�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs|�dS)zHandle a recoverable error.N�)�self�	exceptionrr�'/usr/lib64/python3.6/xml/sax/handler.py�error szErrorHandler.errorcCs|�dS)zHandle a non-recoverable error.Nr)rrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dS)zHandle a warning.N)�print)rrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__�__doc__rrr	rrrrrsrc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ContentHandlerz�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS)N)�_locator)rrrr�__init__6szContentHandler.__init__cCs
||_dS)a#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.N)r)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)z�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).Nr)rrrr�
startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.Nr)rrrr�endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.Nr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)z�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.Nr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdS)z�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.Nr)rrrrr�
endElement�szContentHandler.endElementcCsdS)a�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.Nr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdS)z�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.Nr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdS)a�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.Nr)rZcontentrrr�
characters�szContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.Nr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdS)a�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.Nr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.Nr)rrrrr�
skippedEntity�szContentHandler.skippedEntityN)r
rrr
rrrrrrrrrrrrr"r#rrrrr/s	
rc@s eZdZdZdd�Zdd�ZdS)�
DTDHandlerz�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)r
rrr
r'r(rrrrr$�sr$c@seZdZdZdd�ZdS)�EntityResolvera7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S)z�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.r)rr%r&rrr�
resolveEntity�szEntityResolver.resolveEntityN)r
rrr
r*rrrrr)�sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r
�versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>
s<
"	__pycache__/_exceptions.cpython-36.pyc000064400000012533150347611750013737 0ustar003


 \��@s�dZddlZejdd�dkr*ddlmZ[Gdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z	dS)z!Different kinds of SAX Exceptions�N��java)�	Exceptionc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�SAXExceptiona�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.NcCs||_||_tj||�dS)zUCreates an exception. The message is required, but the exception
        is optional.N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r�+/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r	rrr
�
getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r	rrr
�getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r	rrr
�__str__"szSAXException.__str__cCstd��dS)zvAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.�__getitem__N)�AttributeError)r	Zixrrr
r&szSAXException.__getitem__)N)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
r	s
rc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�SAXParseExceptiona#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCs<tj|||�||_|jj�|_|jj�|_|jj�|_dS)zECreates the exception. The exception parameter is allowed to be None.N)	rr�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r	r
rZlocatorrrr
r;s
zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception
        occurred.)r)r	rrr
rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r	rrr
rMszSAXParseException.getLineNumbercCs
|jj�S)zEGet the public identifier of the entity where the exception occurred.)r�getPublicId)r	rrr
rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r	rrr
rUszSAXParseException.getSystemIdcCsN|j�}|dkrd}|j�}|dkr(d}|j�}|dkr<d}d||||jfS)z0Create a string representation of the exception.Nz	<unknown>�?z%s:%s:%s: %s)rrrr)r	ZsysidZlinenumZcolnumrrr
rYszSAXParseException.__str__N)
rrrrrrrrrrrrrr
r.s
rc@seZdZdZdS)�SAXNotRecognizedExceptionz�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.N)rrrrrrrr
r!isr!c@seZdZdZdS)�SAXNotSupportedExceptionaException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.N)rrrrrrrr
r"ssr"c@seZdZdZdS)�SAXReaderNotAvailableaException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.N)rrrrrrrr
r#}sr#)
r�sys�platformZ	java.langrrrr!r"r#rrrr
�<module>s%;

__pycache__/saxutils.cpython-36.opt-1.pyc000064400000031011150347611750014222 0ustar003


 \�/�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	dd�Z
ifdd	�Zifd
d�Zifdd
�Z
dd�ZGdd�dej�ZGdd�de	j�Zddd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreadercCs&x |j�D]\}}|j||�}q
W|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.6/xml/sax/saxutils.py�__dict_replacesr
cCs6|jdd�}|jdd�}|jdd�}|r2t||�}|S)z�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    �&z&amp;�>z&gt;�<z&lt;)rr
)�data�entitiesrrr�escapes	
rcCs2|jdd�}|jdd�}|r&t||�}|jdd�S)a
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&lt;rz&gt;rz&amp;r)rr
)rrrrr�unescape"s

rcCs\|j�}|jdddd��t||�}d|krPd|krFd|jdd�}qXd	|}nd|}|S)
a�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')�copy�updaterr)rrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDtj
�}dd�|_�j|_y�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S)N)�getattr)�self�name)�outrr�__getattr__[sz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r!r)r rr�_wrapperYsr&cSsdS)Nrrrrr�<lambda>^sz _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrrr'cs�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r r)r-r&�bufferr)r r�_gettextwriterHs.
r?c@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)NrF���)r�ContentHandler�__init__r?r9�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)rr r)Zshort_empty_elementsrrrrDss
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rI)rr�prefixrrr�_qnameszXMLGenerator._qnamecCs|jr|jd�d|_dS)NrF)rMrE)r�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|jd|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rErK)rrrr�
startDocument�szXMLGenerator.startDocumentcCs|j�dS)N)rG)rrrr�endDocument�szXMLGenerator.endDocumentcCs0|jj|jj��||j|<|jj||f�dS)N)rH�appendrIrrJ)rrO�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCs^|j�|jd|�x*|j�D]\}}|jd|t|�f�q W|jrPd|_n
|jd�dS)Nrz %s=%sTr)rRrErrrLrM)rr�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|jd�d|_n|jd|�dS)Nz/>Fz</%s>)rMrE)rrrrrrQ�s
zXMLGenerator.endElementcCs�|j�|jd|j|��x8|jD].\}}|rD|jd||f�q$|jd|�q$Wg|_x0|j�D]$\}}|jd|j|�t|�f�qfW|jr�d|_n
|jd�dS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rr�qnamerYrOrVr
rrr�startElementNS�s zXMLGenerator.startElementNScCs0|jr|jd�d|_n|jd|j|��dS)Nz/>Fz</%s>)rMrErP)rrr[rrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|j�t|t�s"t||j�}|jt|��dS)N)rRr/�strrKrEr)r�contentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|j�t|t�s"t||j�}|j|�dS)N)rRr/r^rKrE)rr_rrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|j�|jd||f�dS)Nz	<?%s %s?>)rRrE)r�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcrrrrr@qs


r@c@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)<�
XMLFilterBaseaYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.NcCstjj|�||_dS)N)r�	XMLReaderrD�_parent)r�parentrrrrD�szXMLFilterBase.__init__cCs|jj|�dS)N)�_err_handler�error)r�	exceptionrrrri�szXMLFilterBase.errorcCs|jj|�dS)N)rh�
fatalError)rrjrrrrk�szXMLFilterBase.fatalErrorcCs|jj|�dS)N)rh�warning)rrjrrrrl�szXMLFilterBase.warningcCs|jj|�dS)N)�
_cont_handler�setDocumentLocator)rZlocatorrrrrn�sz XMLFilterBase.setDocumentLocatorcCs|jj�dS)N)rmrS)rrrrrSszXMLFilterBase.startDocumentcCs|jj�dS)N)rmrT)rrrrrTszXMLFilterBase.endDocumentcCs|jj||�dS)N)rmrW)rrOrVrrrrWsz XMLFilterBase.startPrefixMappingcCs|jj|�dS)N)rmrX)rrOrrrrX	szXMLFilterBase.endPrefixMappingcCs|jj||�dS)N)rmrZ)rrrYrrrrZszXMLFilterBase.startElementcCs|jj|�dS)N)rmrQ)rrrrrrQszXMLFilterBase.endElementcCs|jj|||�dS)N)rmr\)rrr[rYrrrr\szXMLFilterBase.startElementNScCs|jj||�dS)N)rmr])rrr[rrrr]szXMLFilterBase.endElementNScCs|jj|�dS)N)rmr`)rr_rrrr`szXMLFilterBase.characterscCs|jj|�dS)N)rmra)r�charsrrrrasz!XMLFilterBase.ignorableWhitespacecCs|jj||�dS)N)rmrc)rrbrrrrrcsz#XMLFilterBase.processingInstructioncCs|jj|�dS)N)rm�
skippedEntity)rrrrrrp!szXMLFilterBase.skippedEntitycCs|jj|||�dS)N)�_dtd_handler�notationDecl)rr�publicId�systemIdrrrrr&szXMLFilterBase.notationDeclcCs|jj||||�dS)N)rq�unparsedEntityDecl)rrrsrtZndatarrrru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||�S)N)Z_ent_handler�
resolveEntity)rrsrtrrrrv.szXMLFilterBase.resolveEntitycCs@|jj|�|jj|�|jj|�|jj|�|jj|�dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r�sourcerrrrw3s
zXMLFilterBase.parsecCs|jj|�dS)N)rf�	setLocale)rZlocalerrrry:szXMLFilterBase.setLocalecCs|jj|�S)N)rf�
getFeature)rrrrrrz=szXMLFilterBase.getFeaturecCs|jj||�dS)N)rf�
setFeature)rr�staterrrr{@szXMLFilterBase.setFeaturecCs|jj|�S)N)rf�getProperty)rrrrrr}CszXMLFilterBase.getPropertycCs|jj||�dS)N)rf�setProperty)rrr
rrrr~FszXMLFilterBase.setPropertycCs|jS)N)rf)rrrr�	getParentKszXMLFilterBase.getParentcCs
||_dS)N)rf)rrgrrr�	setParentNszXMLFilterBase.setParent)N) r"r#r$�__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rr�rrrrrd�s:
rd�cCst|t�rtj|�}n^t|d�rt|}tj�}t|jd�t�rH|j|�n
|j|�t|d�rtt|jt�rt|j	|j�|j
�dko�|j�dk�r|j�}t
jjt
jj|��}t
jj||�}t
jj|�r�|j	|�t|d�}n$|j	tjj||��tjj|j��}|j|�|S)z�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.�readrrN�rb)r/r^rZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamrZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�os�path�dirname�normpath�join�isfile�open�urllibrwZurljoinZrequestZurlopen)rx�base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceSs*




r�)r�)r�r�Zurllib.parser�Zurllib.requestr0r2r�rrr
rrrr?rCr@rerdr�rrrr�<module>s)so__pycache__/__init__.cpython-36.opt-2.pyc000064400000004076150347611750014121 0ustar003


 \.�@s
ddlmZddlmZmZddlmZmZmZm	Z	m
Z
e�fdd�Ze�fdd�ZdgZ
d	Zerjd	d
lZd	d
lZd	d
lZejjr�dejkr�ejdjd�Z
[d
Zejd
d�dkr�ejje�r�ejje�jd�Z
gfdd�Zejd
d�dkr�dd�Zndd�Z[d
S)�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|j|�|j|�|j|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.6/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|j|�|j|�t�}t|t�rR|j|j	|��n|j
|j|��|j|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javacCsrxb|tD]V}yt|�Stk
rL}zddl}||jkr<�WYdd}~Xq
tk
r^Yq
Xq
Wtdd��dS)NrzNo parsers found)�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er"rrrr
Fs

r
cCs$ddlm}|j|dt��}|j�S)Nr)�imp)Zorg.python.corer&Z
importName�globals�
create_parser)r$r&�
drv_modulerrrr asr cCst|iidg�}|j�S)Nr()�
__import__r()r$r)rrrr gs)Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr�_falseZxml.sax.expatreaderZxml�osr"�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r rrrr�<module>s(
__pycache__/saxutils.cpython-36.pyc000064400000031011150347611750013263 0ustar003


 \�/�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	dd�Z
ifdd	�Zifd
d�Zifdd
�Z
dd�ZGdd�dej�ZGdd�de	j�Zddd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreadercCs&x |j�D]\}}|j||�}q
W|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.6/xml/sax/saxutils.py�__dict_replacesr
cCs6|jdd�}|jdd�}|jdd�}|r2t||�}|S)z�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    �&z&amp;�>z&gt;�<z&lt;)rr
)�data�entitiesrrr�escapes	
rcCs2|jdd�}|jdd�}|r&t||�}|jdd�S)a
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&lt;rz&gt;rz&amp;r)rr
)rrrrr�unescape"s

rcCs\|j�}|jdddd��t||�}d|krPd|krFd|jdd�}qXd	|}nd|}|S)
a�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    z&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')�copy�updaterr)rrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDtj
�}dd�|_�j|_y�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S)N)�getattr)�self�name)�outrr�__getattr__[sz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r!r)r rr�_wrapperYsr&cSsdS)Nrrrrr�<lambda>^sz _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrrr'cs�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r r)r-r&�bufferr)r r�_gettextwriterHs.
r?c@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)NrF���)r�ContentHandler�__init__r?r9�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)rr r)Zshort_empty_elementsrrrrDss
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rI)rr�prefixrrr�_qnameszXMLGenerator._qnamecCs|jr|jd�d|_dS)NrF)rMrE)r�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|jd|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rErK)rrrr�
startDocument�szXMLGenerator.startDocumentcCs|j�dS)N)rG)rrrr�endDocument�szXMLGenerator.endDocumentcCs0|jj|jj��||j|<|jj||f�dS)N)rH�appendrIrrJ)rrO�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCs^|j�|jd|�x*|j�D]\}}|jd|t|�f�q W|jrPd|_n
|jd�dS)Nrz %s=%sTr)rRrErrrLrM)rr�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|jd�d|_n|jd|�dS)Nz/>Fz</%s>)rMrE)rrrrrrQ�s
zXMLGenerator.endElementcCs�|j�|jd|j|��x8|jD].\}}|rD|jd||f�q$|jd|�q$Wg|_x0|j�D]$\}}|jd|j|�t|�f�qfW|jr�d|_n
|jd�dS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rr�qnamerYrOrVr
rrr�startElementNS�s zXMLGenerator.startElementNScCs0|jr|jd�d|_n|jd|j|��dS)Nz/>Fz</%s>)rMrErP)rrr[rrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|j�t|t�s"t||j�}|jt|��dS)N)rRr/�strrKrEr)r�contentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|j�t|t�s"t||j�}|j|�dS)N)rRr/r^rKrE)rr_rrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|j�|jd||f�dS)Nz	<?%s %s?>)rRrE)r�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcrrrrr@qs


r@c@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)<�
XMLFilterBaseaYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.NcCstjj|�||_dS)N)r�	XMLReaderrD�_parent)r�parentrrrrD�szXMLFilterBase.__init__cCs|jj|�dS)N)�_err_handler�error)r�	exceptionrrrri�szXMLFilterBase.errorcCs|jj|�dS)N)rh�
fatalError)rrjrrrrk�szXMLFilterBase.fatalErrorcCs|jj|�dS)N)rh�warning)rrjrrrrl�szXMLFilterBase.warningcCs|jj|�dS)N)�
_cont_handler�setDocumentLocator)rZlocatorrrrrn�sz XMLFilterBase.setDocumentLocatorcCs|jj�dS)N)rmrS)rrrrrSszXMLFilterBase.startDocumentcCs|jj�dS)N)rmrT)rrrrrTszXMLFilterBase.endDocumentcCs|jj||�dS)N)rmrW)rrOrVrrrrWsz XMLFilterBase.startPrefixMappingcCs|jj|�dS)N)rmrX)rrOrrrrX	szXMLFilterBase.endPrefixMappingcCs|jj||�dS)N)rmrZ)rrrYrrrrZszXMLFilterBase.startElementcCs|jj|�dS)N)rmrQ)rrrrrrQszXMLFilterBase.endElementcCs|jj|||�dS)N)rmr\)rrr[rYrrrr\szXMLFilterBase.startElementNScCs|jj||�dS)N)rmr])rrr[rrrr]szXMLFilterBase.endElementNScCs|jj|�dS)N)rmr`)rr_rrrr`szXMLFilterBase.characterscCs|jj|�dS)N)rmra)r�charsrrrrasz!XMLFilterBase.ignorableWhitespacecCs|jj||�dS)N)rmrc)rrbrrrrrcsz#XMLFilterBase.processingInstructioncCs|jj|�dS)N)rm�
skippedEntity)rrrrrrp!szXMLFilterBase.skippedEntitycCs|jj|||�dS)N)�_dtd_handler�notationDecl)rr�publicId�systemIdrrrrr&szXMLFilterBase.notationDeclcCs|jj||||�dS)N)rq�unparsedEntityDecl)rrrsrtZndatarrrru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||�S)N)Z_ent_handler�
resolveEntity)rrsrtrrrrv.szXMLFilterBase.resolveEntitycCs@|jj|�|jj|�|jj|�|jj|�|jj|�dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r�sourcerrrrw3s
zXMLFilterBase.parsecCs|jj|�dS)N)rf�	setLocale)rZlocalerrrry:szXMLFilterBase.setLocalecCs|jj|�S)N)rf�
getFeature)rrrrrrz=szXMLFilterBase.getFeaturecCs|jj||�dS)N)rf�
setFeature)rr�staterrrr{@szXMLFilterBase.setFeaturecCs|jj|�S)N)rf�getProperty)rrrrrr}CszXMLFilterBase.getPropertycCs|jj||�dS)N)rf�setProperty)rrr
rrrr~FszXMLFilterBase.setPropertycCs|jS)N)rf)rrrr�	getParentKszXMLFilterBase.getParentcCs
||_dS)N)rf)rrgrrr�	setParentNszXMLFilterBase.setParent)N) r"r#r$�__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rr�rrrrrd�s:
rd�cCst|t�rtj|�}n^t|d�rt|}tj�}t|jd�t�rH|j|�n
|j|�t|d�rtt|jt�rt|j	|j�|j
�dko�|j�dk�r|j�}t
jjt
jj|��}t
jj||�}t
jj|�r�|j	|�t|d�}n$|j	tjj||��tjj|j��}|j|�|S)z�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.�readrrN�rb)r/r^rZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamrZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�os�path�dirname�normpath�join�isfile�open�urllibrwZurljoinZrequestZurlopen)rx�base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceSs*




r�)r�)r�r�Zurllib.parser�Zurllib.requestr0r2r�rrr
rrrr?rCr@rerdr�rrrr�<module>s)so__pycache__/xmlreader.cpython-36.opt-1.pyc000064400000041034150347611750014337 0ustar003


 \�1�@s�dZddlmZddlmZmZGdd�d�ZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
Gdd�de
�Zdd�Ze
dkr�e�dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�	XMLReadera%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs,tj�|_tj�|_tj�|_tj�|_dS)N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler)�self�r�)/usr/lib64/python3.6/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)�NotImplementedError)r
�sourcerrr�parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r
rrr�getContentHandler"szXMLReader.getContentHandlercCs
||_dS)z:Registers a new object to receive document content events.N)r)r
rrrr�setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r
rrr�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dS)z7Register an object to receive basic DTD-related events.N)r)r
rrrr�
setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r
rrr�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dS)z0Register an object to resolve external entities.N)r)r
Zresolverrrr�setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r	)r
rrr�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dS)z3Register an object to receive error-message events.N)r	)r
rrrr�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)aHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.zLocale support not implementedN)r)r
Zlocalerrr�	setLocaleBszXMLReader.setLocalecCstd|��dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r
�namerrr�
getFeatureKszXMLReader.getFeaturecCstd|��dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r
r�staterrr�
setFeatureOszXMLReader.setFeaturecCstd|��dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r
rrrr�getPropertySszXMLReader.getPropertycCstd|��dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r
r�valuerrr�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__�__doc__r
rrrrrrrrrrrrrr rrrrrs 	rc@sBeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�IncrementalParserasThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.��cCs||_tj|�dS)N)�_bufsizerr
)r
�bufsizerrrr
oszIncrementalParser.__init__cCspddlm}|j|�}|j|�|j�}|dkr8|j�}|j|j�}x|rb|j|�|j|j�}qFW|j	�dS)Nr)�saxutils)
�r*Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr(�feed�close)r
rr*�file�bufferrrrrss


zIncrementalParser.parsecCstd��dS)aThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.z This method must be implemented!N)r)r
�datarrrr0�szIncrementalParser.feedcCstd��dS)ztThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r
rrrrr,�szIncrementalParser.prepareParsercCstd��dS)a�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.z This method must be implemented!N)r)r
rrrr1�szIncrementalParser.closecCstd��dS)z�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.z This method must be implemented!N)r)r
rrr�reset�szIncrementalParser.resetN�)r6)
r!r"r#r$r
rr0r,r1r5rrrrr%[s
	
r%c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Locatorz�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS)z6Return the column number where the current event ends.r���r)r
rrr�getColumnNumber�szLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r)r
rrr�
getLineNumber�szLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr)r
rrr�getPublicId�szLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr)r
rrr�getSystemId�szLocator.getSystemIdN)r!r"r#r$r9r:r;r<rrrrr7�s
r7c@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�InputSourceanEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile)r
�	system_idrrrr
�s
zInputSource.__init__cCs
||_dS)z/Sets the public identifier of this InputSource.N)r?)r
Z	public_idrrr�setPublicId�szInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r
rrrr;�szInputSource.getPublicIdcCs
||_dS)z/Sets the system identifier of this InputSource.N)r>)r
rCrrr�setSystemId�szInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r
rrrr<�szInputSource.getSystemIdcCs
||_dS)a4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N)r@)r
�encodingrrr�setEncoding�szInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r
rrr�getEncoding�szInputSource.getEncodingcCs
||_dS)a�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N)rA)r
Zbytefilerrr�
setByteStream�szInputSource.setByteStreamcCs|jS)z�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.)rA)r
rrrr.�szInputSource.getByteStreamcCs
||_dS)a^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N)rB)r
Zcharfilerrr�setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r
rrrr-szInputSource.getCharacterStream)N)r!r"r#r$r
rDr;rEr<rGrHrIr.rJr-rrrrr=�s



r=c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dS)zQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N)�_attrs)r
�attrsrrrr
szAttributesImpl.__init__cCs
t|j�S)N)�lenrL)r
rrr�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr)r
rrrr�getType!szAttributesImpl.getTypecCs
|j|S)N)rL)r
rrrr�getValue$szAttributesImpl.getValuecCs
|j|S)N)rL)r
rrrr�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|S)N)rL�KeyError)r
rrrr�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|S)N)rLrS)r
rrrr�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|jj��S)N)�listrL�keys)r
rrr�getNames4szAttributesImpl.getNamescCst|jj��S)N)rVrLrW)r
rrr�	getQNames7szAttributesImpl.getQNamescCs
t|j�S)N)rNrL)r
rrr�__len__:szAttributesImpl.__len__cCs
|j|S)N)rL)r
rrrr�__getitem__=szAttributesImpl.__getitem__cCst|jj��S)N)rVrLrW)r
rrrrW@szAttributesImpl.keyscCs
||jkS)N)rL)r
rrrr�__contains__CszAttributesImpl.__contains__NcCs|jj||�S)N)rL�get)r
r�alternativerrrr]FszAttributesImpl.getcCs|j|j�S)N)�	__class__rL)r
rrr�copyIszAttributesImpl.copycCst|jj��S)N)rVrL�items)r
rrrraLszAttributesImpl.itemscCst|jj��S)N)rVrL�values)r
rrrrbOszAttributesImpl.values)N)r!r"r#r
rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbrrrrrKs"
rKc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dS)z�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N)rL�_qnames)r
rMZqnamesrrrr
VszAttributesNSImpl.__init__cCs6x(|jj�D]\}}||kr|j|SqWt|��dS)N)rdrarLrS)r
r�nsname�qnamerrrrR^sz AttributesNSImpl.getValueByQNamecCs0x"|jj�D]\}}||kr|SqWt|��dS)N)rdrarS)r
rrerfrrrrTeszAttributesNSImpl.getNameByQNamecCs
|j|S)N)rd)r
rrrrrUlszAttributesNSImpl.getQNameByNamecCst|jj��S)N)rVrdrb)r
rrrrYoszAttributesNSImpl.getQNamescCs|j|j|j�S)N)r_rLrd)r
rrrr`rszAttributesNSImpl.copyN)	r!r"r#r
rRrTrUrYr`rrrrrcTsrccCst�t�t�dS)N)rr%r7rrrr�_testvsrg�__main__N)r$r+r�_exceptionsrrrr%r7r=rKrcrgr!rrrr�<module>sPJY>"__pycache__/handler.cpython-36.opt-2.pyc000064400000010632150347611750013772 0ustar003


 \b6�@s�dZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zd	Zd
ZdZdZd
Z	dZ
eeeee	e
gZdZdZ
dZdZdZdZeee
eeegZdS)z2.0betac@s$eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCs|�dS)N�)�self�	exceptionrr�'/usr/lib64/python3.6/xml/sax/handler.py�error szErrorHandler.errorcCs|�dS)Nr)rrrrr�
fatalError$szErrorHandler.fatalErrorcCst|�dS)N)�print)rrrrr�warning(szErrorHandler.warningN)�__name__�
__module__�__qualname__rrr	rrrrrs
rc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ContentHandlercCs
d|_dS)N)�_locator)rrrr�__init__6szContentHandler.__init__cCs
||_dS)N)r)rZlocatorrrr�setDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)Nr)rrrr�
startDocumentPszContentHandler.startDocumentcCsdS)Nr)rrrr�endDocumentWszContentHandler.endDocumentcCsdS)Nr)r�prefixZurirrr�startPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)Nr)rrrrr�endPrefixMappingwszContentHandler.endPrefixMappingcCsdS)Nr)r�name�attrsrrr�startElement~szContentHandler.startElementcCsdS)Nr)rrrrr�
endElement�szContentHandler.endElementcCsdS)Nr)rr�qnamerrrr�startElementNS�szContentHandler.startElementNScCsdS)Nr)rrrrrr�endElementNS�szContentHandler.endElementNScCsdS)Nr)rZcontentrrr�
characters�szContentHandler.characterscCsdS)Nr)rZ
whitespacerrr�ignorableWhitespace�sz"ContentHandler.ignorableWhitespacecCsdS)Nr)r�target�datarrr�processingInstruction�sz$ContentHandler.processingInstructioncCsdS)Nr)rrrrr�
skippedEntity�szContentHandler.skippedEntityN)r
rrrrrrrrrrrrrrr!r"rrrrr
/s	
r
c@seZdZdd�Zdd�ZdS)�
DTDHandlercCsdS)Nr)rr�publicId�systemIdrrr�notationDecl�szDTDHandler.notationDeclcCsdS)Nr)rrr$r%Zndatarrr�unparsedEntityDecl�szDTDHandler.unparsedEntityDeclN)r
rrr&r'rrrrr#�sr#c@seZdZdd�ZdS)�EntityResolvercCs|S)Nr)rr$r%rrr�
resolveEntity�szEntityResolver.resolveEntityN)r
rrr)rrrrr(�sr(z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)�versionrr
r#r(Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZall_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr�<module>s:
"	__pycache__/expatreader.cpython-36.pyc000064400000030153150347611750013721 0ustar003


 \X=�@s�dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d	d
�dkr|edd	��[ydd
lmZWnek
r�edd	��YnXeed�s�edd	��ddlmZmZmZejZejZydd	lZWnek
�rdd�ZYnXdd	lZejZ[[Gdd�d�ZGdd�dej�ZGdd�dej ej�Z!dd�Z"e#dk�r�dd	l$Z%e"�Z&e&j'e%j(jj)��e&j*e%j(j+��e&j,d�d	S)z]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S)N�)�orr�+/usr/lib64/python3.6/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ExpatLocatorz�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dS)N)r�_ref)�self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r�_parser�ErrorColumnNumber)rrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N�)rr�ErrorLineNumber)rrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|jj�S)N)r�_source�getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jj�S)N)rr%�getSystemId)rrrrrr'NszExpatLocator.getSystemIdN)	rrr�__doc__rr!r$r&r'rrrrr3src@seZdZdZdGdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�ZdHdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDS)I�ExpatParserz$SAX driver for the pyexpat C module.r���cCsFtjj||�tj�|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserrZInputSourcer%r�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrrZs
zExpatParser.__init__c	CsVtj|�}||_y*|j�|jjt|��tjj	||�Wn|j
��YnXdS)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer%�reset�
_cont_handlerZsetDocumentLocatorrrr-�parse�
_close_source)r�sourcerrrr8gs
zExpatParser.parsecCs |j�dk	r|jj|j��dS)N)r'rZSetBase)rr:rrr�
prepareParserwszExpatParser.prepareParsercCs tjj||�|jr|j�dS)N)rr-�setContentHandlerr0�_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)NrzFeature '%s' not recognized)
rr.rr3rrrrr2�SAXNotRecognizedException)r�namerrr�
getFeature�s
zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized)r0�SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?�staterrr�
setFeature�s2
zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|jj�St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized)r�property_lexical_handlerr/r
r3r	r�hasattrrDr>rA)rr?rrr�getProperty�s

zExpatParser.getPropertycCsV|tjkr ||_|jrR|j�n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setzProperty '%s' not recognized)
rrEr/r0�_reset_lex_handler_propr
r3r	rAr>)rr?�valuerrr�setProperty�s


zExpatParser.setPropertycCsz|js|j�d|_|jj�y|jj||�WnDtjk
rt}z&ttj	|j
�||�}|jj|�WYdd}~XnXdS)Nr")
r0r6r7Z
startDocumentrZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|j�}|dk	r |j�Wd|j�}|dk	r<|j�XdS)N)r%ZgetCharacterStream�closeZ
getByteStream)rr:�filerrrr9�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|jj�d|_d|_Wdd|_|jdk	rzt�}|jj|_|jj	|_	||_|j
�XdS)N�r")rNr)r1r�
isinstancerrQr7ZendDocumentr0r r#r9)rrrrrrR�s




zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7�processingInstructionrZProcessingInstructionHandler�
charactersZCharacterDataHandler)rrrrr=�szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dS)N)r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|jj�d|jd�|_d|j_|j|j_	|j
|j_n,tj|jj�|jd�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr�|j�|j|j_y|j|j_Wntk
r�YnX|jjtj �d|_!g|_"dS)N� )�internr"r)#r.r
rr%ZgetEncodingr3rZnamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr=�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rH�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6







zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s
zExpatParser.getLineNumbercCs
|jj�S)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs
|jj�S)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|��dS)N)r7ZstartElement�AttributesImpl)rr?�attrsrrrr]LszExpatParser.start_elementcCs|jj|�dS)N)r7Z
endElement)rr?rrrr^OszExpatParser.end_elementcCs�|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}x�|j�D]|\}}|j�}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qVW|jj|dt||��dS)Nr"�rz%s:%sr*)�split�len�tuple�itemsr7ZstartElementNS�AttributesNSImpl)rr?rg�pairZnewattrsZqnamesZanamerI�partsZlengthZqnameZapairrrrr[Rs.


zExpatParser.start_element_nscCsV|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|jj|d�dS)Nr"rhr)rirjrkr7ZendElementNS)rr?rnrrrr\ts
zExpatParser.end_element_nscCs|jj||�dS)N)r7rV)r�targetrMrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|jj|�dS)N)r7rW)rrMrrr�character_data�szExpatParser.character_datacCs|jj||�dS)N)r7ZstartPrefixMapping)r�prefixZurirrrra�sz ExpatParser.start_namespace_declcCs|jj|�dS)N)r7ZendPrefixMapping)rrsrrrrb�szExpatParser.end_namespace_declcCs|jj|||�dS)N)r/ZstartDTD)rr?�sysid�pubidZhas_internal_subsetrrrrX�szExpatParser.start_doctype_declcCs|jj||||�dS)N)�_dtd_handlerZunparsedEntityDecl)rr?�basertruZ
notation_namerrrr_�sz ExpatParser.unparsed_entity_declcCs|jj|||�dS)N)rvZnotationDecl)rr?rwrtrurrrr`�szExpatParser.notation_declc	Cs�|js
dS|jj||�}tj||jj�p*d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�Wn
dS|jd\|_	|_|jd=dS)Nr"rTr���rx)r2Z_ent_handlerZ
resolveEntityrr5r%r'r1�appendrZExternalEntityParserCreaterr-r8)r�contextrwrtrur:rrrrc�s 
zExpatParser.external_entity_refcCs|rd|}|jj|�dS)N�%)r7Z
skippedEntity)rr?Zis_perrrrd�sz"ExpatParser.skipped_entity_handlerNi��)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@


'"r)cOs
t||�S)N)r))�args�kwargsrrr�
create_parser�sr�__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrFZxml.saxrrrrfrm�_weakrefr�weakref�proxyrZLocatorrr-r)rrZxml.sax.saxutilsZxml�pr<ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr8rrrr�<module>sN


$_
__pycache__/_exceptions.cpython-36.opt-2.pyc000064400000005351150347611750014677 0ustar003


 \��@s|ddlZejdd�dkr&ddlmZ[Gdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZdS)�N��java)�	Exceptionc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�SAXExceptionNcCs||_||_tj||�dS)N)�_msg�
_exceptionr�__init__)�self�msg�	exception�r�+/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)N)r)r	rrr
�
getMessageszSAXException.getMessagecCs|jS)N)r)r	rrr
�getExceptionszSAXException.getExceptioncCs|jS)N)r)r	rrr
�__str__"szSAXException.__str__cCstd��dS)N�__getitem__)�AttributeError)r	Zixrrr
r&szSAXException.__getitem__)N)�__name__�
__module__�__qualname__rrrrrrrrr
r	s


rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�SAXParseExceptioncCs<tj|||�||_|jj�|_|jj�|_|jj�|_dS)N)	rr�_locator�getSystemId�	_systemId�getColumnNumber�_colnum�
getLineNumber�_linenum)r	r
rZlocatorrrr
r;s
zSAXParseException.__init__cCs|jS)N)r)r	rrr
rHsz!SAXParseException.getColumnNumbercCs|jS)N)r)r	rrr
rMszSAXParseException.getLineNumbercCs
|jj�S)N)r�getPublicId)r	rrr
rQszSAXParseException.getPublicIdcCs|jS)N)r)r	rrr
rUszSAXParseException.getSystemIdcCsN|j�}|dkrd}|j�}|dkr(d}|j�}|dkr<d}d||||jfS)Nz	<unknown>�?z%s:%s:%s: %s)rrrr)r	ZsysidZlinenumZcolnumrrr
rYszSAXParseException.__str__N)	rrrrrrrrrrrrr
r.s

rc@seZdZdS)�SAXNotRecognizedExceptionN)rrrrrrr
r isr c@seZdZdS)�SAXNotSupportedExceptionN)rrrrrrr
r!ssr!c@seZdZdS)�SAXReaderNotAvailableN)rrrrrrr
r"}sr")	�sys�platformZ	java.langrrrr r!r"rrrr
�<module>s%;

__pycache__/xmlreader.cpython-36.opt-2.pyc000064400000024335150347611750014345 0ustar003


 \�1�@s�ddlmZddlmZmZGdd�d�ZGdd�de�ZGdd�d�ZGd	d
�d
�ZGdd�d�Z	Gd
d�de	�Z
dd�Zedkr�e�dS)�)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) �	XMLReadercCs,tj�|_tj�|_tj�|_tj�|_dS)N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler)�self�r�)/usr/lib64/python3.6/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS)Nz This method must be implemented!)�NotImplementedError)r
�sourcerrr�parseszXMLReader.parsecCs|jS)N)r)r
rrr�getContentHandler"szXMLReader.getContentHandlercCs
||_dS)N)r)r
rrrr�setContentHandler&szXMLReader.setContentHandlercCs|jS)N)r)r
rrr�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dS)N)r)r
rrrr�
setDTDHandler.szXMLReader.setDTDHandlercCs|jS)N)r)r
rrr�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dS)N)r)r
Zresolverrrr�setEntityResolver6szXMLReader.setEntityResolvercCs|jS)N)r	)r
rrr�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dS)N)r	)r
rrrr�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)NzLocale support not implemented)r)r
Zlocalerrr�	setLocaleBszXMLReader.setLocalecCstd|��dS)NzFeature '%s' not recognized)r)r
�namerrr�
getFeatureKszXMLReader.getFeaturecCstd|��dS)NzFeature '%s' not recognized)r)r
r�staterrr�
setFeatureOszXMLReader.setFeaturecCstd|��dS)NzProperty '%s' not recognized)r)r
rrrr�getPropertySszXMLReader.getPropertycCstd|��dS)NzProperty '%s' not recognized)r)r
r�valuerrr�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__r
rrrrrrrrrrrrrr rrrrrs
	rc@s>eZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)�IncrementalParser��cCs||_tj|�dS)N)�_bufsizerr
)r
�bufsizerrrr
oszIncrementalParser.__init__cCspddlm}|j|�}|j|�|j�}|dkr8|j�}|j|j�}x|rb|j|�|j|j�}qFW|j	�dS)Nr)�saxutils)
�r)Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr'�feed�close)r
rr)�file�bufferrrrrss


zIncrementalParser.parsecCstd��dS)Nz This method must be implemented!)r)r
�datarrrr/�szIncrementalParser.feedcCstd��dS)Nz!prepareParser must be overridden!)r)r
rrrrr+�szIncrementalParser.prepareParsercCstd��dS)Nz This method must be implemented!)r)r
rrrr0�szIncrementalParser.closecCstd��dS)Nz This method must be implemented!)r)r
rrr�reset�szIncrementalParser.resetN�)r5)	r!r"r#r
rr/r+r0r4rrrrr$[s
	
r$c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LocatorcCsdS)Nr���r)r
rrr�getColumnNumber�szLocator.getColumnNumbercCsdS)Nrr7r)r
rrr�
getLineNumber�szLocator.getLineNumbercCsdS)Nr)r
rrr�getPublicId�szLocator.getPublicIdcCsdS)Nr)r
rrr�getSystemId�szLocator.getSystemIdN)r!r"r#r8r9r:r;rrrrr6�sr6c@sfeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�InputSourceNcCs"||_d|_d|_d|_d|_dS)N)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile)r
�	system_idrrrr
�s
zInputSource.__init__cCs
||_dS)N)r>)r
Z	public_idrrr�setPublicId�szInputSource.setPublicIdcCs|jS)N)r>)r
rrrr:�szInputSource.getPublicIdcCs
||_dS)N)r=)r
rBrrr�setSystemId�szInputSource.setSystemIdcCs|jS)N)r=)r
rrrr;�szInputSource.getSystemIdcCs
||_dS)N)r?)r
�encodingrrr�setEncoding�szInputSource.setEncodingcCs|jS)N)r?)r
rrr�getEncoding�szInputSource.getEncodingcCs
||_dS)N)r@)r
Zbytefilerrr�
setByteStream�szInputSource.setByteStreamcCs|jS)N)r@)r
rrrr-�szInputSource.getByteStreamcCs
||_dS)N)rA)r
Zcharfilerrr�setCharacterStreamszInputSource.setCharacterStreamcCs|jS)N)rA)r
rrrr,szInputSource.getCharacterStream)N)r!r"r#r
rCr:rDr;rFrGrHr-rIr,rrrrr<�s



r<c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dS)N)�_attrs)r
�attrsrrrr
szAttributesImpl.__init__cCs
t|j�S)N)�lenrK)r
rrr�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr)r
rrrr�getType!szAttributesImpl.getTypecCs
|j|S)N)rK)r
rrrr�getValue$szAttributesImpl.getValuecCs
|j|S)N)rK)r
rrrr�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|S)N)rK�KeyError)r
rrrr�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|S)N)rKrR)r
rrrr�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|jj��S)N)�listrK�keys)r
rrr�getNames4szAttributesImpl.getNamescCst|jj��S)N)rUrKrV)r
rrr�	getQNames7szAttributesImpl.getQNamescCs
t|j�S)N)rMrK)r
rrr�__len__:szAttributesImpl.__len__cCs
|j|S)N)rK)r
rrrr�__getitem__=szAttributesImpl.__getitem__cCst|jj��S)N)rUrKrV)r
rrrrV@szAttributesImpl.keyscCs
||jkS)N)rK)r
rrrr�__contains__CszAttributesImpl.__contains__NcCs|jj||�S)N)rK�get)r
r�alternativerrrr\FszAttributesImpl.getcCs|j|j�S)N)�	__class__rK)r
rrr�copyIszAttributesImpl.copycCst|jj��S)N)rUrK�items)r
rrrr`LszAttributesImpl.itemscCst|jj��S)N)rUrK�values)r
rrrraOszAttributesImpl.values)N)r!r"r#r
rNrOrPrQrSrTrWrXrYrZrVr[r\r_r`rarrrrrJs"
rJc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dS)N)rK�_qnames)r
rLZqnamesrrrr
VszAttributesNSImpl.__init__cCs6x(|jj�D]\}}||kr|j|SqWt|��dS)N)rcr`rKrR)r
r�nsname�qnamerrrrQ^sz AttributesNSImpl.getValueByQNamecCs0x"|jj�D]\}}||kr|SqWt|��dS)N)rcr`rR)r
rrdrerrrrSeszAttributesNSImpl.getNameByQNamecCs
|j|S)N)rc)r
rrrrrTlszAttributesNSImpl.getQNameByNamecCst|jj��S)N)rUrcra)r
rrrrXoszAttributesNSImpl.getQNamescCs|j|j|j�S)N)r^rKrc)r
rrrr_rszAttributesNSImpl.copyN)	r!r"r#r
rQrSrTrXr_rrrrrbTsrbcCst�t�t�dS)N)rr$r6rrrr�_testvsrf�__main__N)
r*r�_exceptionsrrrr$r6r<rJrbrfr!rrrr�<module>sPJY>"__pycache__/saxutils.cpython-36.opt-2.pyc000064400000025620150347611750014234 0ustar003


 \�/�@s�ddlZddlZddlZddlZddlZddlmZddlmZdd�Z	ifdd�Z
ifd	d
�Zifdd�Zd
d�Z
Gdd�dej�ZGdd�dej�Zddd�ZdS)�N�)�handler)�	xmlreadercCs&x |j�D]\}}|j||�}q
W|S)N)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.6/xml/sax/saxutils.py�__dict_replacesr
cCs6|jdd�}|jdd�}|jdd�}|r2t||�}|S)N�&z&amp;�>z&gt;�<z&lt;)rr
)�data�entitiesrrr�escapes	
rcCs2|jdd�}|jdd�}|r&t||�}|jdd�S)Nz&lt;rz&gt;rz&amp;r)rr
)rrrrr�unescape"s

rcCs\|j�}|jdddd��t||�}d|krPd|krFd|jdd�}qXd	|}nd|}|S)
Nz&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')�copy�updaterr)rrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDtj
�}dd�|_�j|_y�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S)N)�getattr)�self�name)�outrr�__getattr__[sz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r!r)r rr�_wrapperYsr&cSsdS)Nrrrrr�<lambda>^sz _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrrr'cs�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r r)r-r&�bufferr)r r�_gettextwriterHs.
r?c@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)NrF���)r�ContentHandler�__init__r?r9�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)rr r)Zshort_empty_elementsrrrrDss
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rI)rr�prefixrrr�_qnameszXMLGenerator._qnamecCs|jr|jd�d|_dS)NrF)rMrE)r�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|jd|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rErK)rrrr�
startDocument�szXMLGenerator.startDocumentcCs|j�dS)N)rG)rrrr�endDocument�szXMLGenerator.endDocumentcCs0|jj|jj��||j|<|jj||f�dS)N)rH�appendrIrrJ)rrO�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCs^|j�|jd|�x*|j�D]\}}|jd|t|�f�q W|jrPd|_n
|jd�dS)Nrz %s=%sTr)rRrErrrLrM)rr�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|jd�d|_n|jd|�dS)Nz/>Fz</%s>)rMrE)rrrrrrQ�s
zXMLGenerator.endElementcCs�|j�|jd|j|��x8|jD].\}}|rD|jd||f�q$|jd|�q$Wg|_x0|j�D]$\}}|jd|j|�t|�f�qfW|jr�d|_n
|jd�dS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rr�qnamerYrOrVr
rrr�startElementNS�s zXMLGenerator.startElementNScCs0|jr|jd�d|_n|jd|j|��dS)Nz/>Fz</%s>)rMrErP)rrr[rrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|j�t|t�s"t||j�}|jt|��dS)N)rRr/�strrKrEr)r�contentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|j�t|t�s"t||j�}|j|�dS)N)rRr/r^rKrE)rr_rrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|j�|jd||f�dS)Nz	<?%s %s?>)rRrE)r�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcrrrrr@qs


r@c@s�eZdZd:dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS);�
XMLFilterBaseNcCstjj|�||_dS)N)r�	XMLReaderrD�_parent)r�parentrrrrD�szXMLFilterBase.__init__cCs|jj|�dS)N)�_err_handler�error)r�	exceptionrrrri�szXMLFilterBase.errorcCs|jj|�dS)N)rh�
fatalError)rrjrrrrk�szXMLFilterBase.fatalErrorcCs|jj|�dS)N)rh�warning)rrjrrrrl�szXMLFilterBase.warningcCs|jj|�dS)N)�
_cont_handler�setDocumentLocator)rZlocatorrrrrn�sz XMLFilterBase.setDocumentLocatorcCs|jj�dS)N)rmrS)rrrrrSszXMLFilterBase.startDocumentcCs|jj�dS)N)rmrT)rrrrrTszXMLFilterBase.endDocumentcCs|jj||�dS)N)rmrW)rrOrVrrrrWsz XMLFilterBase.startPrefixMappingcCs|jj|�dS)N)rmrX)rrOrrrrX	szXMLFilterBase.endPrefixMappingcCs|jj||�dS)N)rmrZ)rrrYrrrrZszXMLFilterBase.startElementcCs|jj|�dS)N)rmrQ)rrrrrrQszXMLFilterBase.endElementcCs|jj|||�dS)N)rmr\)rrr[rYrrrr\szXMLFilterBase.startElementNScCs|jj||�dS)N)rmr])rrr[rrrr]szXMLFilterBase.endElementNScCs|jj|�dS)N)rmr`)rr_rrrr`szXMLFilterBase.characterscCs|jj|�dS)N)rmra)r�charsrrrrasz!XMLFilterBase.ignorableWhitespacecCs|jj||�dS)N)rmrc)rrbrrrrrcsz#XMLFilterBase.processingInstructioncCs|jj|�dS)N)rm�
skippedEntity)rrrrrrp!szXMLFilterBase.skippedEntitycCs|jj|||�dS)N)�_dtd_handler�notationDecl)rr�publicId�systemIdrrrrr&szXMLFilterBase.notationDeclcCs|jj||||�dS)N)rq�unparsedEntityDecl)rrrsrtZndatarrrru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||�S)N)Z_ent_handler�
resolveEntity)rrsrtrrrrv.szXMLFilterBase.resolveEntitycCs@|jj|�|jj|�|jj|�|jj|�|jj|�dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r�sourcerrrrw3s
zXMLFilterBase.parsecCs|jj|�dS)N)rf�	setLocale)rZlocalerrrry:szXMLFilterBase.setLocalecCs|jj|�S)N)rf�
getFeature)rrrrrrz=szXMLFilterBase.getFeaturecCs|jj||�dS)N)rf�
setFeature)rr�staterrrr{@szXMLFilterBase.setFeaturecCs|jj|�S)N)rf�getProperty)rrrrrr}CszXMLFilterBase.getPropertycCs|jj||�dS)N)rf�setProperty)rrr
rrrr~FszXMLFilterBase.setPropertycCs|jS)N)rf)rrrr�	getParentKszXMLFilterBase.getParentcCs
||_dS)N)rf)rrgrrr�	setParentNszXMLFilterBase.setParent)N)r"r#r$rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rr�rrrrrd�s8
rd�cCst|t�rtj|�}n^t|d�rt|}tj�}t|jd�t�rH|j|�n
|j|�t|d�rtt|jt�rt|j	|j�|j
�dko�|j�dk�r|j�}t
jjt
jj|��}t
jj||�}t
jj|�r�|j	|�t|d�}n$|j	tjj||��tjj|j��}|j|�|S)N�readrr�rb)r/r^rZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamrZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�os�path�dirname�normpath�join�isfile�open�urllibrwZurljoinZrequestZurlopen)rx�base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceSs*




r�)r�)r�Zurllib.parser�Zurllib.requestr0r2r�rrr
rrrr?rCr@rerdr�rrrr�<module>s)so__pycache__/xmlreader.cpython-36.pyc000064400000041034150347611750013400 0ustar003


 \�1�@s�dZddlmZddlmZmZGdd�d�ZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
Gdd�de
�Zdd�Ze
dkr�e�dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�	XMLReadera%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs,tj�|_tj�|_tj�|_tj�|_dS)N)	rZContentHandler�
_cont_handlerZ
DTDHandler�_dtd_handlerZEntityResolver�_ent_handlerZErrorHandler�_err_handler)�self�r�)/usr/lib64/python3.6/xml/sax/xmlreader.py�__init__s


zXMLReader.__init__cCstd��dS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)�NotImplementedError)r
�sourcerrr�parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r
rrr�getContentHandler"szXMLReader.getContentHandlercCs
||_dS)z:Registers a new object to receive document content events.N)r)r
rrrr�setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r
rrr�
getDTDHandler*szXMLReader.getDTDHandlercCs
||_dS)z7Register an object to receive basic DTD-related events.N)r)r
rrrr�
setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r
rrr�getEntityResolver2szXMLReader.getEntityResolvercCs
||_dS)z0Register an object to resolve external entities.N)r)r
Zresolverrrr�setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r	)r
rrr�getErrorHandler:szXMLReader.getErrorHandlercCs
||_dS)z3Register an object to receive error-message events.N)r	)r
rrrr�setErrorHandler>szXMLReader.setErrorHandlercCstd��dS)aHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.zLocale support not implementedN)r)r
Zlocalerrr�	setLocaleBszXMLReader.setLocalecCstd|��dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r
�namerrr�
getFeatureKszXMLReader.getFeaturecCstd|��dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r
r�staterrr�
setFeatureOszXMLReader.setFeaturecCstd|��dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r
rrrr�getPropertySszXMLReader.getPropertycCstd|��dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r
r�valuerrr�setPropertyWszXMLReader.setPropertyN)�__name__�
__module__�__qualname__�__doc__r
rrrrrrrrrrrrrr rrrrrs 	rc@sBeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�IncrementalParserasThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.��cCs||_tj|�dS)N)�_bufsizerr
)r
�bufsizerrrr
oszIncrementalParser.__init__cCspddlm}|j|�}|j|�|j�}|dkr8|j�}|j|j�}x|rb|j|�|j|j�}qFW|j	�dS)Nr)�saxutils)
�r*Zprepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readr(�feed�close)r
rr*�file�bufferrrrrss


zIncrementalParser.parsecCstd��dS)aThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.z This method must be implemented!N)r)r
�datarrrr0�szIncrementalParser.feedcCstd��dS)ztThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r
rrrrr,�szIncrementalParser.prepareParsercCstd��dS)a�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.z This method must be implemented!N)r)r
rrrr1�szIncrementalParser.closecCstd��dS)z�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.z This method must be implemented!N)r)r
rrr�reset�szIncrementalParser.resetN�)r6)
r!r"r#r$r
rr0r,r1r5rrrrr%[s
	
r%c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Locatorz�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS)z6Return the column number where the current event ends.r���r)r
rrr�getColumnNumber�szLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r)r
rrr�
getLineNumber�szLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr)r
rrr�getPublicId�szLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr)r
rrr�getSystemId�szLocator.getSystemIdN)r!r"r#r$r9r:r;r<rrrrr7�s
r7c@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�InputSourceanEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile)r
�	system_idrrrr
�s
zInputSource.__init__cCs
||_dS)z/Sets the public identifier of this InputSource.N)r?)r
Z	public_idrrr�setPublicId�szInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r
rrrr;�szInputSource.getPublicIdcCs
||_dS)z/Sets the system identifier of this InputSource.N)r>)r
rCrrr�setSystemId�szInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r
rrrr<�szInputSource.getSystemIdcCs
||_dS)a4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N)r@)r
�encodingrrr�setEncoding�szInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r
rrr�getEncoding�szInputSource.getEncodingcCs
||_dS)a�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N)rA)r
Zbytefilerrr�
setByteStream�szInputSource.setByteStreamcCs|jS)z�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.)rA)r
rrrr.�szInputSource.getByteStreamcCs
||_dS)a^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N)rB)r
Zcharfilerrr�setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r
rrrr-szInputSource.getCharacterStream)N)r!r"r#r$r
rDr;rEr<rGrHrIr.rJr-rrrrr=�s



r=c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd$dd�Zdd�Zd d!�Zd"d#�ZdS)%�AttributesImplcCs
||_dS)zQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N)�_attrs)r
�attrsrrrr
szAttributesImpl.__init__cCs
t|j�S)N)�lenrL)r
rrr�	getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr)r
rrrr�getType!szAttributesImpl.getTypecCs
|j|S)N)rL)r
rrrr�getValue$szAttributesImpl.getValuecCs
|j|S)N)rL)r
rrrr�getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt|��|S)N)rL�KeyError)r
rrrr�getNameByQName*s
zAttributesImpl.getNameByQNamecCs||jkrt|��|S)N)rLrS)r
rrrr�getQNameByName/s
zAttributesImpl.getQNameByNamecCst|jj��S)N)�listrL�keys)r
rrr�getNames4szAttributesImpl.getNamescCst|jj��S)N)rVrLrW)r
rrr�	getQNames7szAttributesImpl.getQNamescCs
t|j�S)N)rNrL)r
rrr�__len__:szAttributesImpl.__len__cCs
|j|S)N)rL)r
rrrr�__getitem__=szAttributesImpl.__getitem__cCst|jj��S)N)rVrLrW)r
rrrrW@szAttributesImpl.keyscCs
||jkS)N)rL)r
rrrr�__contains__CszAttributesImpl.__contains__NcCs|jj||�S)N)rL�get)r
r�alternativerrrr]FszAttributesImpl.getcCs|j|j�S)N)�	__class__rL)r
rrr�copyIszAttributesImpl.copycCst|jj��S)N)rVrL�items)r
rrrraLszAttributesImpl.itemscCst|jj��S)N)rVrL�values)r
rrrrbOszAttributesImpl.values)N)r!r"r#r
rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbrrrrrKs"
rKc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�AttributesNSImplcCs||_||_dS)z�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N)rL�_qnames)r
rMZqnamesrrrr
VszAttributesNSImpl.__init__cCs6x(|jj�D]\}}||kr|j|SqWt|��dS)N)rdrarLrS)r
r�nsname�qnamerrrrR^sz AttributesNSImpl.getValueByQNamecCs0x"|jj�D]\}}||kr|SqWt|��dS)N)rdrarS)r
rrerfrrrrTeszAttributesNSImpl.getNameByQNamecCs
|j|S)N)rd)r
rrrrrUlszAttributesNSImpl.getQNameByNamecCst|jj��S)N)rVrdrb)r
rrrrYoszAttributesNSImpl.getQNamescCs|j|j|j�S)N)r_rLrd)r
rrrr`rszAttributesNSImpl.copyN)	r!r"r#r
rRrTrUrYr`rrrrrcTsrccCst�t�t�dS)N)rr%r7rrrr�_testvsrg�__main__N)r$r+r�_exceptionsrrrr%r7r=rKrcrgr!rrrr�<module>sPJY>"__pycache__/__init__.cpython-36.pyc000064400000006132150347611750013154 0ustar003


 \.�@sdZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�fdd�Ze�fdd�Z
d	gZd
Zernd
dlZd
dlZd
dlZejjr�dejkr�ejdjd
�Z[dZejdd�dkr�ejje�r�ejje�jd
�Zgfdd�Zejdd�dk�rdd�Zndd�Z[dS)a�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|j|�|j|�|j|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.6/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|j|�|j|�t�}t|t�rR|j|j	|��n|j
|j|��|j|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javacCsrxb|tD]V}yt|�Stk
rL}zddl}||jkr<�WYdd}~Xq
tk
r^Yq
Xq
Wtdd��dS)a&Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the list created by doing parser_list +
    default_parser_list.  The lists must contain the names of Python
    modules containing both a SAX parser and a create_parser function.rNzNo parsers found)�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er"rrrr
Fs

r
cCs$ddlm}|j|dt��}|j�S)Nr)�imp)Zorg.python.corer&Z
importName�globals�
create_parser)r$r&�
drv_modulerrrr asr cCst|iidg�}|j�S)Nr()�
__import__r()r$r)rrrr gs)�__doc__Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr�_falseZxml.sax.expatreaderZxml�osr"�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r rrrr�<module>s*
__pycache__/__init__.cpython-36.opt-1.pyc000064400000006132150347611750014113 0ustar003


 \.�@sdZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�fdd�Ze�fdd�Z
d	gZd
Zernd
dlZd
dlZd
dlZejjr�dejkr�ejdjd
�Z[dZejdd�dkr�ejje�r�ejje�jd
�Zgfdd�Zejdd�dk�rdd�Zndd�Z[dS)a�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
�)�InputSource)�ContentHandler�ErrorHandler)�SAXException�SAXNotRecognizedException�SAXParseException�SAXNotSupportedException�SAXReaderNotAvailablecCs(t�}|j|�|j|�|j|�dS)N)�make_parser�setContentHandler�setErrorHandler�parse)�source�handler�errorHandler�parser�r�(/usr/lib64/python3.6/xml/sax/__init__.pyr
s

r
cCspddl}|dkrt�}t�}|j|�|j|�t�}t|t�rR|j|j	|��n|j
|j|��|j|�dS)N�)
�iorr
rrr�
isinstance�strZsetCharacterStream�StringIOZ
setByteStream�BytesIOr
)�stringrrrrZinpsrcrrr�parseString#s


rzxml.sax.expatreaderrNZ
PY_SAX_PARSER�,zpython.xml.sax.parser��javacCsrxb|tD]V}yt|�Stk
rL}zddl}||jkr<�WYdd}~Xq
tk
r^Yq
Xq
Wtdd��dS)a&Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the list created by doing parser_list +
    default_parser_list.  The lists must contain the names of Python
    modules containing both a SAX parser and a create_parser function.rNzNo parsers found)�default_parser_list�_create_parser�ImportError�sys�modulesr	)Zparser_list�parser_name�er"rrrr
Fs

r
cCs$ddlm}|j|dt��}|j�S)Nr)�imp)Zorg.python.corer&Z
importName�globals�
create_parser)r$r&�
drv_modulerrrr asr cCst|iidg�}|j�S)Nr()�
__import__r()r$r)rrrr gs)�__doc__Z	xmlreaderrrrr�_exceptionsrrrrr	r
rr�_falseZxml.sax.expatreaderZxml�osr"�flags�ignore_environment�environ�splitZ_key�platform�registryZcontainsKeyZgetPropertyr
r rrrr�<module>s*
__pycache__/expatreader.cpython-36.opt-2.pyc000064400000027316150347611750014670 0ustar003


 \X=�@s�dZddlTddlmZmZddlmZddlmZmZddlmZddlm	Z	m
Z
ddlZejdd	�d
krxe
dd��[yddlmZWnek
r�e
d
d��YnXeed�s�e
d
d��ddlmZmZmZejZejZyddlZWnek
�rdd�ZYnXddlZejZ[[Gdd�d�ZGdd�dej�ZGdd�dejej�Z dd�Z!e"dk�r�ddl#Z$e!�Z%e%j&e$j'jj(��e%j)e$j'j*��e%j+d�dS)z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S)N�)�orr�+/usr/lib64/python3.6/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ExpatLocatorcCst|�|_dS)N)r�_ref)�self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r�_parser�ErrorColumnNumber)rrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N�)rr�ErrorLineNumber)rrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|dkrdS|jj�S)N)r�_source�getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jj�S)N)rr%�getSystemId)rrrrrr'NszExpatLocator.getSystemIdN)rrrrr!r$r&r'rrrrr3s
rc@seZdZdFdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dGdd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Zd?d@�Z dAdB�Z!dCS)H�ExpatParserr���cCsFtjj||�tj�|_d|_||_d|_d|_g|_	d|_
d|_dS)Nr)r�IncrementalParserrZInputSourcer%r�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrrZs
zExpatParser.__init__c	CsVtj|�}||_y*|j�|jjt|��tjj	||�Wn|j
��YnXdS)N)r�prepare_input_sourcer%�reset�
_cont_handlerZsetDocumentLocatorrrr,�parse�
_close_source)r�sourcerrrr7gs
zExpatParser.parsecCs |j�dk	r|jj|j��dS)N)r'rZSetBase)rr9rrr�
prepareParserwszExpatParser.prepareParsercCs tjj||�|jr|j�dS)N)rr,�setContentHandlerr/�_reset_cont_handler)rrrrrr;}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk	S|tttfkr2dS|tkr@|jSt	d|��dS)NrzFeature '%s' not recognized)
rr-rr2rrrrr1�SAXNotRecognizedException)r�namerrr�
getFeature�s
zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdkrRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized)r/�SAXNotSupportedExceptionrr-rr1rr2rrrr=)rr>�staterrr�
setFeature�s2
zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|jj�St	d��nt
d��t	d|��dS)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized)r�property_lexical_handlerr.r
r2r	r�hasattrrCr=r@)rr>rrr�getProperty�s

zExpatParser.getPropertycCsV|tjkr ||_|jrR|j�n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setzProperty '%s' not recognized)
rrDr.r/�_reset_lex_handler_propr
r2r	r@r=)rr>�valuerrr�setProperty�s


zExpatParser.setPropertycCsz|js|j�d|_|jj�y|jj||�WnDtjk
rt}z&ttj	|j
�||�}|jj|�WYdd}~XnXdS)Nr")
r/r5r6Z
startDocumentrZParser
�errorZSAXParseExceptionZErrorString�codeZ_err_handlerZ
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedcCsB|j}z|j�}|dk	r |j�Wd|j�}|dk	r<|j�XdS)N)r%ZgetCharacterStream�closeZ
getByteStream)rr9�filerrrr8�szExpatParser._close_sourcecCs�|js|jdkst|jt�r dSz(|jddd�|jj�d|_d|_Wdd|_|jdk	rzt�}|jj|_|jj	|_	||_|j
�XdS)N�r")rMr)r0r�
isinstancerrPr6ZendDocumentr/r r#r8)rrrrrrQ�s




zExpatParser.closecCs|jj|j_|jj|j_dS)N)r6�processingInstructionrZProcessingInstructionHandler�
charactersZCharacterDataHandler)rrrrr<�szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dS)N)r.rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrGsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|jj�d|jd�|_d|j_|j|j_	|j
|j_n,tj|jj�|jd�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr�|j�|j|j_y|j|j_Wntk
r�YnX|jjtj �d|_!g|_"dS)N� )�internr"r)#r-r
rr%ZgetEncodingr2rZnamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr<�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr.rG�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr/r0)rrrrr5s6







zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s
zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s
zExpatParser.getLineNumbercCs
|jj�S)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs
|jj�S)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|��dS)N)r6ZstartElement�AttributesImpl)rr>�attrsrrrr\LszExpatParser.start_elementcCs|jj|�dS)N)r6Z
endElement)rr>rrrr]OszExpatParser.end_elementcCs�|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}x�|j�D]|\}}|j�}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qVW|jj|dt||��dS)Nr"�rz%s:%sr))�split�len�tuple�itemsr6ZstartElementNS�AttributesNSImpl)rr>rf�pairZnewattrsZqnamesZanamerH�partsZlengthZqnameZapairrrrrZRs.


zExpatParser.start_element_nscCsV|j�}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|jj|d�dS)Nr"rgr)rhrirjr6ZendElementNS)rr>rmrrrr[ts
zExpatParser.end_element_nscCs|jj||�dS)N)r6rU)r�targetrLrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|jj|�dS)N)r6rV)rrLrrr�character_data�szExpatParser.character_datacCs|jj||�dS)N)r6ZstartPrefixMapping)r�prefixZurirrrr`�sz ExpatParser.start_namespace_declcCs|jj|�dS)N)r6ZendPrefixMapping)rrrrrrra�szExpatParser.end_namespace_declcCs|jj|||�dS)N)r.ZstartDTD)rr>�sysid�pubidZhas_internal_subsetrrrrW�szExpatParser.start_doctype_declcCs|jj||||�dS)N)�_dtd_handlerZunparsedEntityDecl)rr>�basersrtZ
notation_namerrrr^�sz ExpatParser.unparsed_entity_declcCs|jj|||�dS)N)ruZnotationDecl)rr>rvrsrtrrrr_�szExpatParser.notation_declc	Cs�|js
dS|jj||�}tj||jj�p*d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�Wn
dS|jd\|_	|_|jd=dS)Nr"rSr���rw)r1Z_ent_handlerZ
resolveEntityrr4r%r'r0�appendrZExternalEntityParserCreaterr,r7)r�contextrvrsrtr9rrrrb�s 
zExpatParser.external_entity_refcCs|rd|}|jj|�dS)N�%)r6Z
skippedEntity)rr>Zis_perrrrc�sz"ExpatParser.skipped_entity_handlerNi��)rr{)r)"rrrrr7r:r;r?rBrFrIrPr8rQr<rGr5r!r$r&r'r\r]rZr[rprqr`rarWr^r_rbrcrrrrr(Ws>


'"r(cOs
t||�S)N)r()�args�kwargsrrr�
create_parser�sr~�__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrEZxml.saxrrrrerl�_weakrefr�weakref�proxyrZLocatorrr,r(r~rZxml.sax.saxutilsZxml�pr;ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr7rrrr�<module>sL


$_
saxutils.pyo000064400000034721150350057610007162 0ustar00�
{fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej	ej
gZWnek
r�ej	gZnXd�Z
id�Zid�Zid�Zd�Zdejfd	��YZd
ejfd��YZdejfd
��YZdd�ZdS(snA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
i����NcCs3x,|j�D]\}}|j||�}q
W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd�}|jdd�}|jdd�}|rNt||�}n|S(s�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    t&s&amp;t>s&gt;t<s&lt;(RR(tdatatentities((s(/usr/lib64/python2.7/xml/sax/saxutils.pytescapes	cCsL|jdd�}|jdd�}|r<t||�}n|jdd�S(s
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    s&lt;R	s&gt;Rs&amp;R(RR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pytunescape's
cCs�|j�}|jidd6dd6dd6�t||�}d|kr{d|krnd	|jdd
�}q�d|}n
d	|}|S(s�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    s&#10;s
s&#13;s
s&#9;s	t"t's"%s"s&quot;s'%s'(tcopytupdateRR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	quoteattr5s"

cCs�|dkr$ddl}|j}nt|tj�rTtj|�}d�|_nTtj�}d�|_|j	|_	y|j
|_
|j|_Wntk
r�nXt
|d|dddd�S(	Ni����cSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<lambda>VtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines
(Rtsyststdoutt
isinstancetiot	RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"
R'cBseZd�ZRS(cCs$tt|�j|�|j�dS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t
__module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jstXMLGeneratorcBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(s
iso-8859-1cCsitjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_dS(Ni����(thandlertContentHandlert__init__R*R#t_writeR,t_flusht_ns_contextst_current_contextt_undeclared_ns_mapst	_encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs	cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s
cCs|jd|j�dS(Nu$<?xml version="1.0" encoding="%s"?>
(R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
startDocument�s	cCs|j�dS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendDocument�scCs@|jj|jj��||j|<|jj||f�dS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMapping�s
cCs|jd|_|jd=dS(Ni����(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMapping�scCs\|jd|�x7|j�D])\}}|jd|t|�f�qW|jd�dS(Nu<u %s=%su>(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElement�s!cCs|jd|�dS(Nu</%s>(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
endElement�scCs�|jd|j|��xH|jD]=\}}|rP|jd||f�q$|jd|�q$Wg|_x@|j�D]2\}}|jd|j|�t|�f�q{W|jd�dS(Nu<u xmlns:%s="%s"u xmlns="%s"u %s=%su>(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNS�s	*cCs|jd|j|��dS(Nu</%s>(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendElementNS�scCs;t|t�s$t||j�}n|jt|��dS(N(RtunicodeR9R4R(R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
characters�scCs5t|t�s$t||j�}n|j|�dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespace�scCs|jd||f�dS(Nu	<?%s %s?>(R4(R-ttargetR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstruction�sN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps
											t
XMLFilterBasecBs
eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.cCstjj|�||_dS(N(t	xmlreadert	XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3�scCs|jj|�dS(N(t_err_handlerterror(R-t	exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRV�scCs|jj|�dS(N(RUt
fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRX�scCs|jj|�dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRY�scCs|jj|�dS(N(t
_cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[�scCs|jj�dS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>�scCs|jj�dS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?�scCs|jj||�dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRB�scCs|jj|�dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRC�scCs|jj||�dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRE�scCs|jj|�dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRF�scCs|jj|||�dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRH�scCs|jj||�dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRI�scCs|jj|�dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRL�scCs|jj|�dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRM�scCs|jj||�dS(N(RZRO(R-RNR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|�dS(N(RZt
skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||�dS(N(t_dtd_handlertnotationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR`	scCs|jj||||�dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRcscCs|jj||�S(N(t_ent_handlert
resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj|�|jj|�|jj|�|jj|�|jj|�dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks
cCs|jj|�dS(N(RSt	setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|�S(N(RSt
getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||�dS(N(RSt
setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|�S(N(RStgetProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||�dS(N(RStsetProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	getParent.scCs
||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRP�s:																										RcCst|�tkr$tj|�}nSt|d�rw|}tj�}|j|�t|d�rw|j|j�qwn|j�dkry|j
�}tjj
tjj|��}tj�}t|t�rt|t�sdy|j|�}Wqtk
r|j|�}qXqdnHt|t�rdy|j|�}Wqdtk
r`|j|�}qdXntjj||�}tjj|�}Wntk
r�t}nX|r�|j|�t|d�}n4|jtj||j
���tj|j
��}|j|�n|S(s�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet_StringTypesRQtInputSourcethasattrt
setByteStreamtsetSystemIdR;t
getByteStreamRtgetSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfiletUnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt
sysidfilenameR�((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF





(RvR�R�R�ttypesRRR1RQt
StringTypetUnicodeTypeRzR&RRR
RR*t
TextIOWrapperR'R2R0RRRPR�(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<module>s$0
		Woxmlreader.pyo000064400000045426150350057620007276 0ustar00�
{fc@s�dZddlZddlmZmZddd��YZdefd��YZddd	��YZd
dd��YZddd
��YZ	de	fd��YZ
d�Zedkr�e�ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. i����N(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont	XMLReadercBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(s%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs@tj�|_tj�|_tj�|_tj�|_dS(N(	thandlertContentHandlert
_cont_handlert
DTDHandlert_dtd_handlertEntityResolvert_ent_handlertErrorHandlert_err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstd��dS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(Rtsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs
||_dS(s:Registers a new object to receive document content events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getDTDHandler*scCs
||_dS(s7Register an object to receive basic DTD-related events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R	(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs
||_dS(s0Register an object to resolve external entities.N(R	(Rtresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs
||_dS(s3Register an object to receive error-message events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstd��dS(sHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.sLocale support not implementedN(R(Rtlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	setLocaleBscCstd|��dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(Rtname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getFeatureKscCstd|��dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(RRtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setFeatureOscCstd|��dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPropertySscCstd|��dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(RRtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPropertyWs(t__name__t
__module__t__doc__R
RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRs 															tIncrementalParsercBsGeZdZd	d�Zd�Zd�Zd�Zd�Zd�ZRS(
ssThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.iicCs||_tj|�dS(N(t_bufsizeRR
(Rtbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
os	cCs�ddl}|j|�}|j|�|j�}|j|j�}x/|dkrw|j|�|j|j�}qIW|j�dS(Ni����t(tsaxutilstprepare_input_sourcet
prepareParsert
getByteStreamtreadR'tfeedtclose(RRR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss

cCstd��dS(sThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.s This method must be implemented!N(R(Rtdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstd��dS(stThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,�scCstd��dS(s�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0�scCstd��dS(s�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytreset�si(	R#R$R%R
RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s					
tLocatorcBs2eZdZd�Zd�Zd�Zd�ZRS(s�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS(s6Return the column number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumber�scCsdS(s4Return the line number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getLineNumber�scCsdS(s3Return the public identifier for the current event.N(tNone(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPublicId�scCsdS(s3Return the system identifier for the current event.N(R8(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetSystemId�s(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5�s
			tInputSourcecBsteZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(
snEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(Rt	system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
�s
				cCs
||_dS(s/Sets the public identifier of this InputSource.N(R=(Rt	public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPublicId�scCs|jS(s2Returns the public identifier of this InputSource.(R=(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9�scCs
||_dS(s/Sets the system identifier of this InputSource.N(R<(RRA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetSystemId�scCs|jS(s2Returns the system identifier of this InputSource.(R<(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:�scCs
||_dS(s4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N(R>(Rtencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEncoding�scCs|jS(s/Get the character encoding of this InputSource.(R>(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEncoding�scCs
||_dS(s�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N(R?(Rtbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setByteStream�scCs|jS(s�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.(R?(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-�scCs
||_dS(s^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N(R@(Rtcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R
RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;�s					
		
		
tAttributesImplcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zd�Zd�ZRS(cCs
||_dS(sQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N(t_attrs(Rtattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
scCs
t|j�S(N(tlenRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getLengthscCsdS(NtCDATA((RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|�n|S(N(RNtKeyError(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(scCs||jkrt|�n|S(N(RNRV(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-scCs
|jj�S(N(RNtkeys(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getQNames5scCs
t|j�S(N(RPRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__getitem__;scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__contains__DscCs|jj||�S(N(RNtget(RRtalternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|j�S(N(t	__class__RN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs
|jj�S(N(RNtitems(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs
|jj�S(N(RNtvalues(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R
RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$																tAttributesNSImplcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_dS(s�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(RROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
Ws	cCsDx4|jj�D]#\}}||kr|j|SqWt|�dS(N(RgRdRNRV(RRtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_scCs=x-|jj�D]\}}||kr|SqWt|�dS(N(RgRdRV(RRRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfscCs|j|S(N(Rg(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs
|jj�S(N(RgRe(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|j�S(N(RbRNRg(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R
RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs					cCst�t�t�dS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__(((((
R%Rt_exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt<module>sPHYA"	__init__.pyo000064400000007241150350057620007043 0ustar00�
{fc@sjdZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�d�Ze�d�Z
dgZdZer�dd	lZndd	lZdd	lZejjr�d
ejkr�ejd
jd�Zn[dZejd
 dkr/ejje�r/ejje�jd�Zngd�Zejd
 dkrZd�Zn	d�Z[d	S(s�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
i����(tInputSource(tContentHandlertErrorHandler(tSAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t�}|j|�|j|�|j|�dS(N(tmake_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlerterrorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyRs	

cCs�yddlm}Wn!tk
r7ddlm}nX|dkrPt�}nt�}|j|�|j|�t�}|j	||��|j
|�dS(Ni����(tStringIO(t	cStringIORtImportErrortNoneRRR	R
Rt
setByteStreamR(tstringR
RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pytparseString#s
	

	sxml.sax.expatreaderiNt
PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|�SWqtk
rU}ddl}||jkrf�qfqtk
reqXqWtdd��dS(s&Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the list created by doing parser_list +
    default_parser_list.  The lists must contain the names of Python
    modules containing both a SAX parser and a create_parser function.i����NsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(tparser_listtparser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs	
cCs2ddlm}|j|dt��}|j�S(Ni����(timpi(torg.python.coreR"t
importNametglobalst
create_parser(R R"t
drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg�}|j�S(NR&(t
__import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t	xmlreaderRR
RRt_exceptionsRRRRRRRRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistrytcontainsKeytgetPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyt<module>s*(	%	_exceptions.pyc000064400000014031150350057620007603 0ustar00�
{fc@s�dZddlZejd dkr8ddlmZn[defd��YZdefd	��YZd
efd��YZdefd
��YZdefd��YZ	dS(s!Different kinds of SAX Exceptionsi����Nitjava(t	ExceptiontSAXExceptioncBs>eZdZdd�Zd�Zd�Zd�Zd�ZRS(s�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.cCs&||_||_tj||�dS(sUCreates an exception. The message is required, but the exception
        is optional.N(t_msgt
_exceptionRt__init__(tselftmsgt	exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs		cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt
getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pytgetExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstd��dS(svAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.t__getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR&sN(	t__name__t
__module__t__doc__tNoneRR	R
RR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR	s			tSAXParseExceptioncBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCsVtj|||�||_|jj�|_|jj�|_|jj�|_dS(sECreates the exception. The exception parameter is allowed to be None.N(	RRt_locatortgetSystemIdt	_systemIdtgetColumnNumbert_colnumt
getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s
	cCs|jS(sNThe column number of the end of the text where the exception
        occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs
|jj�S(sEGet the public identifier of the entity where the exception occurred.(RtgetPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j�}|dkr!d}n|j�}|dkrBd}n|j�}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s	<unknown>t?s%s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRYs			(	RRRRRRRRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s	
				tSAXNotRecognizedExceptioncBseZdZRS(s�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s(
Rtsystplatformt	java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt<module>s%;

handler.pyc000064400000031344150350057620006706 0ustar00�
{fc@s�dZdZddd��YZddd��YZddd��YZddd	��YZd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS(s0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
s2.0betatErrorHandlercBs)eZdZd�Zd�Zd�ZRS(s�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs
|�dS(sHandle a recoverable error.N((tselft	exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs
|�dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
fatalError$scCs	|GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t
__module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs		tContentHandlercBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(s�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs
||_dS(s#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.N(R(Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(s�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt
startDocumentPtcCsdS(sQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pytendDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(s�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElement~RcCsdS(s�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
endElement�RcCsdS(s�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNS�RcCsdS(s�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pytendElementNS�RcCsdS(s�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt
characters�RcCsdS(swReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.N((Rt
whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespace�RcCsdS(s�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstruction�RcCsdS(sReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
skippedEntity�R(RRRRRRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR	/s												
		t
DTDHandlercBs eZdZd�Zd�ZRS(s�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pytnotationDecl�RcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDecl�R(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%�s	tEntityResolvercBseZdZd�ZRS(s7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S(s�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt
resolveEntity�s(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+�ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR	R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pestall_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt<module>
s:
�		_exceptions.pyo000064400000014031150350057630007620 0ustar00�
{fc@s�dZddlZejd dkr8ddlmZn[defd��YZdefd	��YZd
efd��YZdefd
��YZdefd��YZ	dS(s!Different kinds of SAX Exceptionsi����Nitjava(t	ExceptiontSAXExceptioncBs>eZdZdd�Zd�Zd�Zd�Zd�ZRS(s�Encapsulate an XML error or warning. This class can contain
    basic error or warning information from either the XML parser or
    the application: you can subclass it to provide additional
    functionality, or to add localization. Note that although you will
    receive a SAXException as the argument to the handlers in the
    ErrorHandler interface, you are not actually required to raise
    the exception; instead, you can simply read the information in
    it.cCs&||_||_tj||�dS(sUCreates an exception. The message is required, but the exception
        is optional.N(t_msgt
_exceptionRt__init__(tselftmsgt	exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs		cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt
getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pytgetExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstd��dS(svAvoids weird error messages if someone does exception[ix] by
        mistake, since Exception has __getitem__ defined.t__getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR&sN(	t__name__t
__module__t__doc__tNoneRR	R
RR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR	s			tSAXParseExceptioncBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s#Encapsulate an XML parse error or warning.

    This exception will include information for locating the error in
    the original XML document. Note that although the application will
    receive a SAXParseException as the argument to the handlers in the
    ErrorHandler interface, the application is not actually required
    to raise the exception; instead, it can simply read the
    information in it and take a different action.

    Since this exception is a subclass of SAXException, it inherits
    the ability to wrap another exception.cCsVtj|||�||_|jj�|_|jj�|_|jj�|_dS(sECreates the exception. The exception parameter is allowed to be None.N(	RRt_locatortgetSystemIdt	_systemIdtgetColumnNumbert_colnumt
getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s
	cCs|jS(sNThe column number of the end of the text where the exception
        occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs
|jj�S(sEGet the public identifier of the entity where the exception occurred.(RtgetPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j�}|dkr!d}n|j�}|dkrBd}n|j�}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s	<unknown>t?s%s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRYs			(	RRRRRRRRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s	
				tSAXNotRecognizedExceptioncBseZdZRS(s�Exception class for an unrecognized identifier.

    An XMLReader will raise this exception when it is confronted with an
    unrecognized feature or property. SAX applications and extensions may
    use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation.

    An XMLReader will raise this exception when a service it cannot
    perform is requested (specifically setting a state or value). SAX
    applications and extensions may use this class for similar
    purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver.

    An XMLReader module (driver) should raise this exception when it
    is first imported, e.g. when a support module cannot be imported.
    It also may be raised during parsing, e.g. if executing an external
    program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s(
Rtsystplatformt	java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt<module>s%;

xmlreader.pyc000064400000045426150350057630007263 0ustar00�
{fc@s�dZddlZddlmZmZddd��YZdefd��YZddd	��YZd
dd��YZddd
��YZ	de	fd��YZ
d�Zedkr�e�ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. i����N(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont	XMLReadercBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(s%Interface for reading an XML document using callbacks.

    XMLReader is the interface that an XML parser's SAX2 driver must
    implement. This interface allows an application to set and query
    features and properties in the parser, to register event handlers
    for document processing, and to initiate a document parse.

    All SAX interfaces are assumed to be synchronous: the parse
    methods must not return until parsing is complete, and readers
    must wait for an event-handler callback to return before reporting
    the next event.cCs@tj�|_tj�|_tj�|_tj�|_dS(N(	thandlertContentHandlert
_cont_handlert
DTDHandlert_dtd_handlertEntityResolvert_ent_handlertErrorHandlert_err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstd��dS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(Rtsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs
||_dS(s:Registers a new object to receive document content events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getDTDHandler*scCs
||_dS(s7Register an object to receive basic DTD-related events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R	(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs
||_dS(s0Register an object to resolve external entities.N(R	(Rtresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs
||_dS(s3Register an object to receive error-message events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstd��dS(sHAllow an application to set the locale for errors and warnings.

        SAX parsers are not required to provide localization for errors
        and warnings; if they cannot support the requested locale,
        however, they must raise a SAX exception. Applications may
        request a locale change in the middle of a parse.sLocale support not implementedN(R(Rtlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	setLocaleBscCstd|��dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(Rtname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getFeatureKscCstd|��dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(RRtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setFeatureOscCstd|��dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPropertySscCstd|��dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(RRtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPropertyWs(t__name__t
__module__t__doc__R
RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRs 															tIncrementalParsercBsGeZdZd	d�Zd�Zd�Zd�Zd�Zd�ZRS(
ssThis interface adds three extra methods to the XMLReader
    interface that allow XML parsers to support incremental
    parsing. Support for this interface is optional, since not all
    underlying XML parsers support this functionality.

    When the parser is instantiated it is ready to begin accepting
    data from the feed method immediately. After parsing has been
    finished with a call to close the reset method must be called to
    make the parser ready to accept new data, either from feed or
    using the parse method.

    Note that these methods must _not_ be called during parsing, that
    is, after parse has been called and before it returns.

    By default, the class also implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.iicCs||_tj|�dS(N(t_bufsizeRR
(Rtbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
os	cCs�ddl}|j|�}|j|�|j�}|j|j�}x/|dkrw|j|�|j|j�}qIW|j�dS(Ni����t(tsaxutilstprepare_input_sourcet
prepareParsert
getByteStreamtreadR'tfeedtclose(RRR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss

cCstd��dS(sThis method gives the raw XML data in the data parameter to
        the parser and makes it parse the data, emitting the
        corresponding events. It is allowed for XML constructs to be
        split across several calls to feed.

        feed may raise SAXException.s This method must be implemented!N(R(Rtdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstd��dS(stThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,�scCstd��dS(s�This method is called when the entire XML document has been
        passed to the parser through the feed method, to notify the
        parser that there are no more data. This allows the parser to
        do the final checks on the document and empty the internal
        data buffer.

        The parser will not be ready to parse another document until
        the reset method has been called.

        close may raise SAXException.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0�scCstd��dS(s�This method is called after close has been called to reset
        the parser so that it is ready to parse new documents. The
        results of calling parse or feed after close without calling
        reset are undefined.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytreset�si(	R#R$R%R
RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s					
tLocatorcBs2eZdZd�Zd�Zd�Zd�ZRS(s�Interface for associating a SAX event with a document
    location. A locator object will return valid results only during
    calls to DocumentHandler methods; at any other time, the
    results are unpredictable.cCsdS(s6Return the column number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumber�scCsdS(s4Return the line number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getLineNumber�scCsdS(s3Return the public identifier for the current event.N(tNone(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPublicId�scCsdS(s3Return the system identifier for the current event.N(R8(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetSystemId�s(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5�s
			tInputSourcecBsteZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(
snEncapsulation of the information needed by the XMLReader to
    read entities.

    This class may include information about the public identifier,
    system identifier, byte stream (possibly with character encoding
    information) and/or the character stream of an entity.

    Applications will create objects of this class for use in the
    XMLReader.parse method and for returning from
    EntityResolver.resolveEntity.

    An InputSource belongs to the application, the XMLReader is not
    allowed to modify InputSource objects passed to it from the
    application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(Rt	system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
�s
				cCs
||_dS(s/Sets the public identifier of this InputSource.N(R=(Rt	public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPublicId�scCs|jS(s2Returns the public identifier of this InputSource.(R=(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9�scCs
||_dS(s/Sets the system identifier of this InputSource.N(R<(RRA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetSystemId�scCs|jS(s2Returns the system identifier of this InputSource.(R<(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:�scCs
||_dS(s4Sets the character encoding of this InputSource.

        The encoding must be a string acceptable for an XML encoding
        declaration (see section 4.3.3 of the XML recommendation).

        The encoding attribute of the InputSource is ignored if the
        InputSource also contains a character stream.N(R>(Rtencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEncoding�scCs|jS(s/Get the character encoding of this InputSource.(R>(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEncoding�scCs
||_dS(s�Set the byte stream (a Python file-like object which does
        not perform byte-to-character conversion) for this input
        source.

        The SAX parser will ignore this if there is also a character
        stream specified, but it will use a byte stream in preference
        to opening a URI connection itself.

        If the application knows the character encoding of the byte
        stream, it should set it with the setEncoding method.N(R?(Rtbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setByteStream�scCs|jS(s�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.(R?(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-�scCs
||_dS(s^Set the character stream for this input source. (The stream
        must be a Python 2.0 Unicode-wrapped file-like that performs
        conversion to Unicode strings.)

        If there is a character stream specified, the SAX parser will
        ignore any byte stream and will not attempt to open a URI
        connection to the system identifier.N(R@(Rtcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R
RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;�s					
		
		
tAttributesImplcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zd�Zd�ZRS(cCs
||_dS(sQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N(t_attrs(Rtattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
scCs
t|j�S(N(tlenRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getLengthscCsdS(NtCDATA((RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|�n|S(N(RNtKeyError(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(scCs||jkrt|�n|S(N(RNRV(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-scCs
|jj�S(N(RNtkeys(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getQNames5scCs
t|j�S(N(RPRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__getitem__;scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__contains__DscCs|jj||�S(N(RNtget(RRtalternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|j�S(N(t	__class__RN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs
|jj�S(N(RNtitems(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs
|jj�S(N(RNtvalues(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R
RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$																tAttributesNSImplcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_dS(s�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(RROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
Ws	cCsDx4|jj�D]#\}}||kr|j|SqWt|�dS(N(RgRdRNRV(RRtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_scCs=x-|jj�D]\}}||kr|SqWt|�dS(N(RgRdRV(RRRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfscCs|j|S(N(Rg(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs
|jj�S(N(RgRe(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|j�S(N(RbRNRg(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R
RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs					cCst�t�t�dS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__(((((
R%Rt_exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt<module>sPHYA"	expatreader.pyo000064400000035505150350057630007615 0ustar00�
{fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d
 dkr�ede��n[ydd
lmZWn ek
r�ede��n#Xeed�rede��nddlmZmZmZejZejZydd	lZWnek
r_d�ZnXdd	lZejZ[[dfd��YZdejfd��YZ dej!ejfd��YZ"d�Z#e$dkr/dd	l%Z&e#�Z'e'j(e&j)jj*��e'j+e&j)j,��e'j-d�nd	S(s]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
s0.20i����(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedtParserCreate(t	xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st
_ClosedParsercBseZRS((t__name__t
__module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.stExpatLocatorcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s	cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getLineNumberBs	cCs&|j}|dkrdS|jj�S(N(RRt_sourcetgetPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs	cCs&|j}|dkrdS|jj�S(N(RRRtgetSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns	(RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s				tExpatParsercBs.eZdZdd%d�Zd�Zd�Zd�Zd	�Zd
�Zd�Z	d�Z
dd
�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Z d#�Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||�tj�|_d|_||_d|_d|_	g|_
d|_d|_dS(Nii(
RtIncrementalParserRtInputSourceRRRt_namespacest_lex_handler_propt_parsingt
_entity_stackt
_external_gest
_interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs						cCsjtj|�}||_y7|j�|jjt|��tjj	||�Wn|j
��nXdS(s3Parse an XML document from a URL or an InputSource.N(R
tprepare_input_sourceRtresett
_cont_handlertsetDocumentLocatorRRR$tparset
_close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs	

cCsV|j�dk	rR|j�}t|t�r?|jd�}n|jj|�ndS(Nsutf-8(R!Rt
isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
prepareParserws
cCs-tjj||�|jr)|j�ndS(N(RR$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;�s	cCsl|tkr|jS|tkr,|jdk	S|tttfkrEdS|tkrX|j	St
d|��dS(NisFeature '%s' not recognized(RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getFeature�s
	cCs|jrtd��n|tkr0||_n�|tkrH||_n�|tkr�|rx|jdkr�i|_q�qd|_n||t	kr�|rtd��qnX|t
kr�|rtd��qn4|tkr�|rtd��qntd|��dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized(
R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
setFeature�s2	cCs�|tjkr|jS|tkr)|jS|tkr{|jrlt|jd�r]|jj�St	d��q{t
d��nt	d|��dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized(Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetProperty�s	
cCs||tjkr1||_|jrx|j�qxnG|tkrI||_n/|tkrhtd|��nt	d|��dS(NsProperty '%s' cannot be setsProperty '%s' not recognized(
RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsetProperty�s		
cCs�|js,|j�d|_|jj�ny|jj||�WnDtjk
r�}ttj	|j
�||�}|jj|�nXdS(Ni(
R(R/R0t
startDocumentRtParseR
terrortSAXParseExceptiontErrorStringtcodet_err_handlert
fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeed�s	
	cCs_|j}z)|j�}|dk	r1|j�nWd|j�}|dk	rZ|j�nXdS(N(RtgetCharacterStreamRtcloset
getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3�s	cCs�|js*|jdks*t|jt�r.dSz6|jddd�|jj�d|_d|_Wdd|_|jdk	r�t�}|jj	|_	|jj
|_
||_n|j�XdS(NtRSii(R)RRR5RRVR0tendDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRX�s
	
		cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert
characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs�|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j	|_|j
|_|j|_|j|_dS(N(
R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt
startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs						cCsc|jr]tj|jj�dd|j�|_d|j_|j|j_	|j
|j_nBtj|jj�d|j�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr|j�n|j|j_y|j|j_Wntk
r9nX|jj tj!�d|_"g|_#dS(Nt tinternii($R&R
RRtgetEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert
start_elementtend_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert
notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6	
		

	
	cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs
|jj�S(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs
|jj�S(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|��dS(N(R0tstartElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|�dS(N(R0t
endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRscCsL|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}i}i}x�|j�D]�\}}|j�}t|�}	|	dkr�|}
d|f}nQ|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<q{W|jj|dt||��dS(Niiis%s:%si(tsplittlenRttupletitemsR0tstartElementNStAttributesNSImpl(RR>R�tpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.

cCsy|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}|jj|d�dS(Niii(R�R�RR�R0tendElementNS(RR>R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrwscCs|jj||�dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instruction�scCs|jj|�dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_data�scCs|jj||�dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRz�scCs|jj|�dS(N(R0tendPrefixMapping(RR�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|�scCs|jj|||�dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRi�scCs|jj||||�dS(N(t_dtd_handlertunparsedEntityDecl(RR>R9R�R�t
notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRv�scCs|jj|||�dS(N(R�tnotationDecl(RR>R9R�R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRx�scCs�|js
dS|jj||�}tj||jj�p=d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�WndSX|jd\|_	|_|jd=dS(NiR[ii����(R*t_ent_handlert
resolveEntityR
R.RR!R)tappendRtExternalEntityParserCreateRR$R2(RtcontextR9R�R�R4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR�s 				
cCs'|rd|}n|jj|�dS(Nt%(R0t
skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR��s
ii�("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrR�R�RzR|RiRvRxRR�(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@
													'							"									cOs
t||�S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
create_parser�st__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRtxml.parsersR
tImportErrorREtxml.saxRR
RR�R�t_weakrefRtweakreftproxyRtLocatorRR$R#R�Rtxml.sax.saxutilstxmltpR;tsaxtXMLGeneratortsetErrorHandlertErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt<module>sL

		

	$�a		expatreader.pyc000064400000035505150350057630007601 0ustar00�
{fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d
 dkr�ede��n[ydd
lmZWn ek
r�ede��n#Xeed�rede��nddlmZmZmZejZejZydd	lZWnek
r_d�ZnXdd	lZejZ[[dfd��YZdejfd��YZ dej!ejfd��YZ"d�Z#e$dkr/dd	l%Z&e#�Z'e'j(e&j)jj*��e'j+e&j)j,��e'j-d�nd	S(s]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
s0.20i����(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedtParserCreate(t	xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st
_ClosedParsercBseZRS((t__name__t
__module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.stExpatLocatorcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s	cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getLineNumberBs	cCs&|j}|dkrdS|jj�S(N(RRt_sourcetgetPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs	cCs&|j}|dkrdS|jj�S(N(RRRtgetSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns	(RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s				tExpatParsercBs.eZdZdd%d�Zd�Zd�Zd�Zd	�Zd
�Zd�Z	d�Z
dd
�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Z d#�Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||�tj�|_d|_||_d|_d|_	g|_
d|_d|_dS(Nii(
RtIncrementalParserRtInputSourceRRRt_namespacest_lex_handler_propt_parsingt
_entity_stackt
_external_gest
_interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs						cCsjtj|�}||_y7|j�|jjt|��tjj	||�Wn|j
��nXdS(s3Parse an XML document from a URL or an InputSource.N(R
tprepare_input_sourceRtresett
_cont_handlertsetDocumentLocatorRRR$tparset
_close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs	

cCsV|j�dk	rR|j�}t|t�r?|jd�}n|jj|�ndS(Nsutf-8(R!Rt
isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
prepareParserws
cCs-tjj||�|jr)|j�ndS(N(RR$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;�s	cCsl|tkr|jS|tkr,|jdk	S|tttfkrEdS|tkrX|j	St
d|��dS(NisFeature '%s' not recognized(RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getFeature�s
	cCs|jrtd��n|tkr0||_n�|tkrH||_n�|tkr�|rx|jdkr�i|_q�qd|_n||t	kr�|rtd��qnX|t
kr�|rtd��qn4|tkr�|rtd��qntd|��dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized(
R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
setFeature�s2	cCs�|tjkr|jS|tkr)|jS|tkr{|jrlt|jd�r]|jj�St	d��q{t
d��nt	d|��dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized(Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetProperty�s	
cCs||tjkr1||_|jrx|j�qxnG|tkrI||_n/|tkrhtd|��nt	d|��dS(NsProperty '%s' cannot be setsProperty '%s' not recognized(
RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsetProperty�s		
cCs�|js,|j�d|_|jj�ny|jj||�WnDtjk
r�}ttj	|j
�||�}|jj|�nXdS(Ni(
R(R/R0t
startDocumentRtParseR
terrortSAXParseExceptiontErrorStringtcodet_err_handlert
fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeed�s	
	cCs_|j}z)|j�}|dk	r1|j�nWd|j�}|dk	rZ|j�nXdS(N(RtgetCharacterStreamRtcloset
getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3�s	cCs�|js*|jdks*t|jt�r.dSz6|jddd�|jj�d|_d|_Wdd|_|jdk	r�t�}|jj	|_	|jj
|_
||_n|j�XdS(NtRSii(R)RRR5RRVR0tendDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRX�s
	
		cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert
characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs�|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j	|_|j
|_|j|_|j|_dS(N(
R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt
startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs						cCsc|jr]tj|jj�dd|j�|_d|j_|j|j_	|j
|j_nBtj|jj�d|j�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr|j�n|j|j_y|j|j_Wntk
r9nX|jj tj!�d|_"g|_#dS(Nt tinternii($R&R
RRtgetEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert
start_elementtend_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert
notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6	
		

	
	cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs
|jj�S(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs
|jj�S(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|��dS(N(R0tstartElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|�dS(N(R0t
endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRscCsL|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}i}i}x�|j�D]�\}}|j�}t|�}	|	dkr�|}
d|f}nQ|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<q{W|jj|dt||��dS(Niiis%s:%si(tsplittlenRttupletitemsR0tstartElementNStAttributesNSImpl(RR>R�tpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.

cCsy|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}|jj|d�dS(Niii(R�R�RR�R0tendElementNS(RR>R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrwscCs|jj||�dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instruction�scCs|jj|�dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_data�scCs|jj||�dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRz�scCs|jj|�dS(N(R0tendPrefixMapping(RR�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|�scCs|jj|||�dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRi�scCs|jj||||�dS(N(t_dtd_handlertunparsedEntityDecl(RR>R9R�R�t
notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRv�scCs|jj|||�dS(N(R�tnotationDecl(RR>R9R�R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRx�scCs�|js
dS|jj||�}tj||jj�p=d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�WndSX|jd\|_	|_|jd=dS(NiR[ii����(R*t_ent_handlert
resolveEntityR
R.RR!R)tappendRtExternalEntityParserCreateRR$R2(RtcontextR9R�R�R4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR�s 				
cCs'|rd|}n|jj|�dS(Nt%(R0t
skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR��s
ii�("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrR�R�RzR|RiRvRxRR�(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@
													'							"									cOs
t||�S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
create_parser�st__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRtxml.parsersR
tImportErrorREtxml.saxRR
RR�R�t_weakrefRtweakreftproxyRtLocatorRR$R#R�Rtxml.sax.saxutilstxmltpR;tsaxtXMLGeneratortsetErrorHandlertErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt<module>sL

		

	$�a		saxutils.pyc000064400000034721150350057640007151 0ustar00�
{fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej	ej
gZWnek
r�ej	gZnXd�Z
id�Zid�Zid�Zd�Zdejfd	��YZd
ejfd��YZdejfd
��YZdd�ZdS(snA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
i����NcCs3x,|j�D]\}}|j||�}q
W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd�}|jdd�}|jdd�}|rNt||�}n|S(s�Escape &, <, and > in a string of data.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    t&s&amp;t>s&gt;t<s&lt;(RR(tdatatentities((s(/usr/lib64/python2.7/xml/sax/saxutils.pytescapes	cCsL|jdd�}|jdd�}|r<t||�}n|jdd�S(s
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    s&lt;R	s&gt;Rs&amp;R(RR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pytunescape's
cCs�|j�}|jidd6dd6dd6�t||�}d|kr{d|krnd	|jdd
�}q�d|}n
d	|}|S(s�Escape and quote an attribute value.

    Escape &, <, and > in a string of data, then quote it for use as
    an attribute value.  The " character will be escaped as well, if
    necessary.

    You can escape other strings of data by passing a dictionary as
    the optional entities parameter.  The keys and values must all be
    strings; each key will be replaced with its corresponding value.
    s&#10;s
s&#13;s
s&#9;s	t"t's"%s"s&quot;s'%s'(tcopytupdateRR(R
R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	quoteattr5s"

cCs�|dkr$ddl}|j}nt|tj�rTtj|�}d�|_nTtj�}d�|_|j	|_	y|j
|_
|j|_Wntk
r�nXt
|d|dddd�S(	Ni����cSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<lambda>VtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines
(Rtsyststdoutt
isinstancetiot	RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"
R'cBseZd�ZRS(cCs$tt|�j|�|j�dS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t
__module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jstXMLGeneratorcBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(s
iso-8859-1cCsitjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_dS(Ni����(thandlertContentHandlert__init__R*R#t_writeR,t_flusht_ns_contextst_current_contextt_undeclared_ns_mapst	_encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs	cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s
cCs|jd|j�dS(Nu$<?xml version="1.0" encoding="%s"?>
(R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
startDocument�s	cCs|j�dS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendDocument�scCs@|jj|jj��||j|<|jj||f�dS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMapping�s
cCs|jd|_|jd=dS(Ni����(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMapping�scCs\|jd|�x7|j�D])\}}|jd|t|�f�qW|jd�dS(Nu<u %s=%su>(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElement�s!cCs|jd|�dS(Nu</%s>(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
endElement�scCs�|jd|j|��xH|jD]=\}}|rP|jd||f�q$|jd|�q$Wg|_x@|j�D]2\}}|jd|j|�t|�f�q{W|jd�dS(Nu<u xmlns:%s="%s"u xmlns="%s"u %s=%su>(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNS�s	*cCs|jd|j|��dS(Nu</%s>(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendElementNS�scCs;t|t�s$t||j�}n|jt|��dS(N(RtunicodeR9R4R(R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt
characters�scCs5t|t�s$t||j�}n|j|�dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespace�scCs|jd||f�dS(Nu	<?%s %s?>(R4(R-ttargetR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstruction�sN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps
											t
XMLFilterBasecBs
eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sYThis class is designed to sit between an XMLReader and the
    client application's event handlers.  By default, it does nothing
    but pass requests up to the reader and events on to the handlers
    unmodified, but subclasses can override specific methods to modify
    the event stream or the configuration requests as they pass
    through.cCstjj|�||_dS(N(t	xmlreadert	XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3�scCs|jj|�dS(N(t_err_handlerterror(R-t	exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRV�scCs|jj|�dS(N(RUt
fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRX�scCs|jj|�dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRY�scCs|jj|�dS(N(t
_cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[�scCs|jj�dS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>�scCs|jj�dS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?�scCs|jj||�dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRB�scCs|jj|�dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRC�scCs|jj||�dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRE�scCs|jj|�dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRF�scCs|jj|||�dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRH�scCs|jj||�dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRI�scCs|jj|�dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRL�scCs|jj|�dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRM�scCs|jj||�dS(N(RZRO(R-RNR
((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|�dS(N(RZt
skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||�dS(N(t_dtd_handlertnotationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR`	scCs|jj||||�dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRcscCs|jj||�S(N(t_ent_handlert
resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj|�|jj|�|jj|�|jj|�|jj|�dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks
cCs|jj|�dS(N(RSt	setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|�S(N(RSt
getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||�dS(N(RSt
setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|�S(N(RStgetProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||�dS(N(RStsetProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	getParent.scCs
||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt	setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRP�s:																										RcCst|�tkr$tj|�}nSt|d�rw|}tj�}|j|�t|d�rw|j|j�qwn|j�dkry|j
�}tjj
tjj|��}tj�}t|t�rt|t�sdy|j|�}Wqtk
r|j|�}qXqdnHt|t�rdy|j|�}Wqdtk
r`|j|�}qdXntjj||�}tjj|�}Wntk
r�t}nX|r�|j|�t|d�}n4|jtj||j
���tj|j
��}|j|�n|S(s�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet_StringTypesRQtInputSourcethasattrt
setByteStreamtsetSystemIdR;t
getByteStreamRtgetSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfiletUnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt
sysidfilenameR�((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF





(RvR�R�R�ttypesRRR1RQt
StringTypetUnicodeTypeRzR&RRR
RR*t
TextIOWrapperR'R2R0RRRPR�(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt<module>s$0
		Wohandler.pyo000064400000031344150350057640006724 0ustar00�
{fc@s�dZdZddd��YZddd��YZddd��YZddd	��YZd
ZdZdZd
Z	dZ
dZeeee	e
egZdZ
dZdZdZdZdZe
eeeeegZdS(s0
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.

Many of these classes are empty and are included only as documentation
of the interfaces.

$Id$
s2.0betatErrorHandlercBs)eZdZd�Zd�Zd�ZRS(s�Basic interface for SAX error handlers.

    If you create an object that implements this interface, then
    register the object with your XMLReader, the parser will call the
    methods in your object to report all warnings and errors. There
    are three levels of errors available: warnings, (possibly)
    recoverable errors, and unrecoverable errors. All methods take a
    SAXParseException as the only parameter.cCs
|�dS(sHandle a recoverable error.N((tselft	exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs
|�dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
fatalError$scCs	|GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t
__module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs		tContentHandlercBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(s�Interface for receiving logical document content events.

    This is the main callback interface in SAX, and the one most
    important to applications. The order of events in this interface
    mirrors the order of the information in the document.cCs
d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs
||_dS(s#Called by the parser to give the application a locator for
        locating the origin of document events.

        SAX parsers are strongly encouraged (though not absolutely
        required) to supply a locator: if it does so, it must supply
        the locator to the application by invoking this method before
        invoking any of the other methods in the DocumentHandler
        interface.

        The locator allows the application to determine the end
        position of any document-related event, even if the parser is
        not reporting an error. Typically, the application will use
        this information for reporting its own errors (such as
        character content that does not match an application's
        business rules). The information returned by the locator is
        probably not sufficient for use with a search engine.

        Note that the locator will return correct information only
        during the invocation of the events in this interface. The
        application should not attempt to use it at any other time.N(R(Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(s�Receive notification of the beginning of a document.

        The SAX parser will invoke this method only once, before any
        other methods in this interface or in DTDHandler (except for
        setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt
startDocumentPtcCsdS(sQReceive notification of the end of a document.

        The SAX parser will invoke this method only once, and it will
        be the last method invoked during the parse. The parser shall
        not invoke this method until it has either abandoned parsing
        (because of an unrecoverable error) or reached the end of
        input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pytendDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping.

        The information from this event is not necessary for normal
        Namespace processing: the SAX XML reader will automatically
        replace prefixes for element and attribute names when the
        http://xml.org/sax/features/namespaces feature is true (the
        default).

        There are cases, however, when applications need to use
        prefixes in character data or in attribute values, where they
        cannot safely be expanded automatically; the
        start/endPrefixMapping event supplies the information to the
        application to expand prefixes in those contexts itself, if
        necessary.

        Note that start/endPrefixMapping events are not guaranteed to
        be properly nested relative to each-other: all
        startPrefixMapping events will occur before the corresponding
        startElement event, and all endPrefixMapping events will occur
        after the corresponding endElement event, but their order is
        not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(s�End the scope of a prefix-URI mapping.

        See startPrefixMapping for details. This event will always
        occur after the corresponding endElement event, but the order
        of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode.

        The name parameter contains the raw XML 1.0 name of the
        element type as a string and the attrs parameter holds an
        instance of the Attributes class containing the attributes of
        the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElement~RcCsdS(s�Signals the end of an element in non-namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
endElement�RcCsdS(s�Signals the start of an element in namespace mode.

        The name parameter contains the name of the element type as a
        (uri, localname) tuple, the qname parameter the raw XML 1.0
        name used in the source document, and the attrs parameter
        holds an instance of the Attributes class containing the
        attributes of the element.

        The uri part of the name tuple is None for elements which have
        no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNS�RcCsdS(s�Signals the end of an element in namespace mode.

        The name parameter contains the name of the element type, just
        as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pytendElementNS�RcCsdS(s�Receive notification of character data.

        The Parser will call this method to report each chunk of
        character data. SAX parsers may return all contiguous
        character data in a single chunk, or they may split it into
        several chunks; however, all of the characters in any single
        event must come from the same external entity so that the
        Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt
characters�RcCsdS(swReceive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk
        of ignorable whitespace (see the W3C XML 1.0 recommendation,
        section 2.10): non-validating parsers may also use this method
        if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single
        chunk, or they may split it into several chunks; however, all
        of the characters in any single event must come from the same
        external entity, so that the Locator provides useful
        information.N((Rt
whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespace�RcCsdS(s�Receive notification of a processing instruction.

        The Parser will invoke this method once for each processing
        instruction found: note that processing instructions may occur
        before or after the main document element.

        A SAX parser should never report an XML declaration (XML 1.0,
        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
        using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstruction�RcCsdS(sReceive notification of a skipped entity.

        The Parser will invoke this method once for each entity
        skipped. Non-validating processors may skip entities if they
        have not seen the declarations (because, for example, the
        entity was declared in an external DTD subset). All processors
        may skip external entities, depending on the values of the
        http://xml.org/sax/features/external-general-entities and the
        http://xml.org/sax/features/external-parameter-entities
        properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt
skippedEntity�R(RRRRRRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR	/s												
		t
DTDHandlercBs eZdZd�Zd�ZRS(s�Handle DTD events.

    This interface specifies only those DTD events required for basic
    parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pytnotationDecl�RcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDecl�R(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%�s	tEntityResolvercBseZdZd�ZRS(s7Basic interface for resolving entities. If you create an object
    implementing this interface, then register the object with your
    Parser, the parser will call the method in your object to
    resolve all external entities. Note that DefaultHandler implements
    this interface with the default behaviour.cCs|S(s�Resolve the system identifier of an entity and return either
        the system identifier to read from as a string, or an InputSource
        to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt
resolveEntity�s(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+�ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR	R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pestall_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt<module>
s:
�		__init__.pyc000064400000007241150350057640007031 0ustar00�
{fc@sjdZddlmZddlmZmZddlmZmZm	Z	m
Z
mZe�d�Ze�d�Z
dgZdZer�dd	lZndd	lZdd	lZejjr�d
ejkr�ejd
jd�Zn[dZejd
 dkr/ejje�r/ejje�jd�Zngd�Zejd
 dkrZd�Zn	d�Z[d	S(s�Simple API for XML (SAX) implementation for Python.

This module provides an implementation of the SAX 2 interface;
information about the Java version of the interface can be found at
http://www.megginson.com/SAX/.  The Python version of the interface is
documented at <...>.

This package contains the following modules:

handler -- Base classes and constants which define the SAX 2 API for
           the 'client-side' of SAX for Python.

saxutils -- Implementation of the convenience classes commonly used to
            work with SAX.

xmlreader -- Base classes and constants which define the SAX 2 API for
             the parsers used with SAX for Python.

expatreader -- Driver that allows use of the Expat parser with SAX.
i����(tInputSource(tContentHandlertErrorHandler(tSAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t�}|j|�|j|�|j|�dS(N(tmake_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlerterrorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyRs	

cCs�yddlm}Wn!tk
r7ddlm}nX|dkrPt�}nt�}|j|�|j|�t�}|j	||��|j
|�dS(Ni����(tStringIO(t	cStringIORtImportErrortNoneRRR	R
Rt
setByteStreamR(tstringR
RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pytparseString#s
	

	sxml.sax.expatreaderiNt
PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|�SWqtk
rU}ddl}||jkrf�qfqtk
reqXqWtdd��dS(s&Creates and returns a SAX parser.

    Creates the first parser it is able to instantiate of the ones
    given in the list created by doing parser_list +
    default_parser_list.  The lists must contain the names of Python
    modules containing both a SAX parser and a create_parser function.i����NsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(tparser_listtparser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs	
cCs2ddlm}|j|dt��}|j�S(Ni����(timpi(torg.python.coreR"t
importNametglobalst
create_parser(R R"t
drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg�}|j�S(NR&(t
__import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t	xmlreaderRR
RRt_exceptionsRRRRRRRRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistrytcontainsKeytgetPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyt<module>s*(	%