ok

Mini Shell

Direktori : /proc/thread-self/root/usr/lib64/python3.6/xml/sax/__pycache__/
Upload File :
Current File : //proc/thread-self/root/usr/lib64/python3.6/xml/sax/__pycache__/xmlreader.cpython-36.pyc

3


 \�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>"

Zerion Mini Shell 1.0