AlkantarClanX12

Your IP : 3.147.76.183


Current Path : /opt/alt/python311/lib64/python3.11/xml/sax/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/xml/sax/__pycache__/xmlreader.cpython-311.opt-1.pyc

�

c��f�1����dZddlmZddlmZmZGd�d��ZGd�de��ZGd�d	��ZGd
�d��Z	Gd�d
��Z
Gd�de
��Zd�Ze
dkre��dSdS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc�l�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZdS)�	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.c���tj��|_tj��|_tj��|_tj��|_dS�N)	r�ContentHandler�
_cont_handler�
DTDHandler�_dtd_handler�EntityResolver�_ent_handler�ErrorHandler�_err_handler��selfs �8/opt/alt/python311/lib64/python3.11/xml/sax/xmlreader.py�__init__zXMLReader.__init__sL��$�3�5�5���#�.�0�0���#�2�4�4���#�0�2�2�����c� �td���)zAParse an XML document from a system identifier or an InputSource.� This method must be implemented!��NotImplementedError�r�sources  r�parsezXMLReader.parses��!�"D�E�E�Erc��|jS)z#Returns the current ContentHandler.�rrs r�getContentHandlerzXMLReader.getContentHandler"s���!�!rc��||_dS)z:Registers a new object to receive document content events.Nr�rrs  r�setContentHandlerzXMLReader.setContentHandler&s��$����rc��|jS)z Returns the current DTD handler.�r
rs r�
getDTDHandlerzXMLReader.getDTDHandler*���� � rc��||_dS)z7Register an object to receive basic DTD-related events.Nr%r"s  r�
setDTDHandlerzXMLReader.setDTDHandler.���#����rc��|jS)z#Returns the current EntityResolver.�rrs r�getEntityResolverzXMLReader.getEntityResolver2r'rc��||_dS)z0Register an object to resolve external entities.Nr,)r�resolvers  r�setEntityResolverzXMLReader.setEntityResolver6s��$����rc��|jS)z!Returns the current ErrorHandler.�rrs r�getErrorHandlerzXMLReader.getErrorHandler:r'rc��||_dS)z3Register an object to receive error-message events.Nr2r"s  r�setErrorHandlerzXMLReader.setErrorHandler>r*rc� �td���)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 implemented)r)r�locales  r�	setLocalezXMLReader.setLocaleBs��'�'G�H�H�Hrc�&�td|z���)z1Looks up and returns the state of a SAX2 feature.�Feature '%s' not recognized�r�r�names  r�
getFeaturezXMLReader.getFeatureK���'�(E��(L�M�M�Mrc�&�td|z���)z!Sets the state of a SAX2 feature.r:r;)rr=�states   r�
setFeaturezXMLReader.setFeatureOr?rc�&�td|z���)z2Looks up and returns the value of a SAX2 property.�Property '%s' not recognizedr;r<s  r�getPropertyzXMLReader.getPropertyS���'�(F��(M�N�N�Nrc�&�td|z���)z"Sets the value of a SAX2 property.rDr;)rr=�values   r�setPropertyzXMLReader.setPropertyWrFrN)�__name__�
__module__�__qualname__�__doc__rrr r#r&r)r-r0r3r5r8r>rBrErI�rrrrs������
�
�3�3�3�F�F�F�"�"�"�%�%�%�!�!�!�$�$�$�!�!�!�%�%�%�!�!�!�$�$�$�I�I�I�N�N�N�N�N�N�O�O�O�O�O�O�O�Orrc�8�eZdZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d	S)�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.�c�H�||_t�|��dSr	)�_bufsizerr)r�bufsizes  rrzIncrementalParser.__init__os#����
����4� � � � � rc�|�ddlm}|�|��}|�|��|���}|�|���}|�|j��}|r1|�|��|�|j��}|�1|�	��dS)Nr)�saxutils)
�rV�prepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readrS�feed�close)rrrV�file�buffers     rrzIncrementalParser.parsess����������.�.�v�6�6�����6�"�"�"��(�(�*�*���<��'�'�)�)�D����4�=�)�)���	.��I�I�f�����Y�Y�t�}�-�-�F��	.�	
�
�
�����rc� �td���)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.rr)r�datas  rr]zIncrementalParser.feed�s��"�"D�E�E�Erc� �td���)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!rrs  rrYzIncrementalParser.prepareParser�s��"�"E�F�F�Frc� �td���)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.rrrs rr^zIncrementalParser.close�s��"�"D�E�E�Erc� �td���)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.rrrs r�resetzIncrementalParser.reset�s��
"�"D�E�E�ErN)rQ)
rJrKrLrMrrr]rYr^rfrNrrrPrP[s���������&!�!�!�!����F�F�F�G�G�G�
F�F�F�F�F�F�F�FrrPc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�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.c��dS)z6Return the column number where the current event ends.���rNrs r�getColumnNumberzLocator.getColumnNumber�����rrc��dS)z4Return the line number where the current event ends.rjrNrs r�
getLineNumberzLocator.getLineNumber�rlrc��dS)z3Return the public identifier for the current event.NrNrs r�getPublicIdzLocator.getPublicId�����trc��dS)z3Return the system identifier for the current event.NrNrs r�getSystemIdzLocator.getSystemId�rqrN)rJrKrLrMrkrnrprsrNrrrhrh�sZ������"�"�
�������������rrhc�V�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�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.Nc�L�||_d|_d|_d|_d|_dSr	)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile�r�	system_ids  rrzInputSource.__init__�s+��$����������������rc��||_dS)z/Sets the public identifier of this InputSource.N�rx)r�	public_ids  r�setPublicIdzInputSource.setPublicId����$����rc��|jS)z2Returns the public identifier of this InputSource.rrs rrpzInputSource.getPublicId������rc��||_dS)z/Sets the system identifier of this InputSource.N�rwr|s  r�setSystemIdzInputSource.setSystemId�r�rc��|jS)z2Returns the system identifier of this InputSource.r�rs rrszInputSource.getSystemId�r�rc��||_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�ry)r�encodings  r�setEncodingzInputSource.setEncoding����#����rc��|jS)z/Get the character encoding of this InputSource.r�rs r�getEncodingzInputSource.getEncoding��
����rc��||_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�rz)r�bytefiles  r�
setByteStreamzInputSource.setByteStream�s��#����rc��|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.r�rs rr[zInputSource.getByteStream�s��
��rc��||_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�r{)r�charfiles  r�setCharacterStreamzInputSource.setCharacterStreamr�rc��|jS)z/Get the character stream for this input source.r�rs rrZzInputSource.getCharacterStreamr�rr	)rJrKrLrMrr�rpr�rsr�r�r�r[r�rZrNrrruru�s�������
B�
B� � � � �%�%�%� � � �%�%�%� � � �#�#�#����#�#�#����#�#�#�����rruc�v�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zd�Zd�ZdS)�AttributesImplc��||_dS)zQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N��_attrs)r�attrss  rrzAttributesImpl.__init__s������rc�*�t|j��Sr	��lenr�rs r�	getLengthzAttributesImpl.getLength����4�;���rc��dS)N�CDATArNr<s  r�getTypezAttributesImpl.getType!s���wrc��|j|Sr	r�r<s  r�getValuezAttributesImpl.getValue$����{�4� � rc��|j|Sr	r�r<s  r�getValueByQNamezAttributesImpl.getValueByQName'r�rc�6�||jvrt|���|Sr	�r��KeyErrorr<s  r�getNameByQNamezAttributesImpl.getNameByQName*� ���t�{�"�"��4�.�.� ��rc�6�||jvrt|���|Sr	r�r<s  r�getQNameByNamezAttributesImpl.getQNameByName/r�rc�N�t|j�����Sr	��listr��keysrs r�getNameszAttributesImpl.getNames4����D�K�$�$�&�&�'�'�'rc�N�t|j�����Sr	r�rs r�	getQNameszAttributesImpl.getQNames7r�rc�*�t|j��Sr	r�rs r�__len__zAttributesImpl.__len__:r�rc��|j|Sr	r�r<s  r�__getitem__zAttributesImpl.__getitem__=r�rc�N�t|j�����Sr	r�rs rr�zAttributesImpl.keys@r�rc��||jvSr	r�r<s  r�__contains__zAttributesImpl.__contains__Cs���t�{�"�"rNc�8�|j�||��Sr	)r��get)rr=�alternatives   rr�zAttributesImpl.getFs���{���t�[�1�1�1rc�6�|�|j��Sr	)�	__class__r�rs r�copyzAttributesImpl.copyIs���~�~�d�k�*�*�*rc�N�t|j�����Sr	)r�r��itemsrs rr�zAttributesImpl.itemsLs���D�K�%�%�'�'�(�(�(rc�N�t|j�����Sr	)r�r��valuesrs rr�zAttributesImpl.valuesOs���D�K�&�&�(�(�)�)�)rr	)rJrKrLrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rNrrr�r�s��������� � � ����!�!�!�!�!�!����
���
(�(�(�(�(�(� � � �!�!�!�(�(�(�#�#�#�2�2�2�2�+�+�+�)�)�)�*�*�*�*�*rr�c�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�AttributesNSImplc�"�||_||_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)rr��qnamess   rrzAttributesNSImpl.__init__Vs��
�������rc��|j���D]\}}||kr|j|cS�t|���r	)r�r�r�r��rr=�nsname�qnames    rr�z AttributesNSImpl.getValueByQName^sR��#�|�1�1�3�3�	+�	+�O�V�U���}�}��{�6�*�*�*�*���t�n�n�rc�r�|j���D]\}}||kr|cS�t|���r	)r�r�r�r�s    rr�zAttributesNSImpl.getNameByQNameesH��#�|�1�1�3�3�	�	�O�V�U���}�}��
�
�
���t�n�n�rc��|j|Sr	)r�r<s  rr�zAttributesNSImpl.getQNameByNamels���|�D�!�!rc�N�t|j�����Sr	)r�r�r�rs rr�zAttributesNSImpl.getQNamesos���D�L�'�'�)�)�*�*�*rc�B�|�|j|j��Sr	)r�r�r�rs rr�zAttributesNSImpl.copyrs���~�~�d�k�4�<�8�8�8rN)	rJrKrLrr�r�r�r�r�rNrrr�r�Tsn���������������"�"�"�+�+�+�9�9�9�9�9rr�c�Z�t��t��t��dSr	)rrPrhrNrr�_testr�vs$��
�K�K�K������I�I�I�I�Ir�__main__N)rMrWr�_exceptionsrrrrPrhrur�r�r�rJrNrr�<module>r�s���"�"�������L�L�L�L�L�L�L�L�
NO�NO�NO�NO�NO�NO�NO�NO�`FF�FF�FF�FF�FF�	�FF�FF�FF�T��������0U�U�U�U�U�U�U�U�r:*�:*�:*�:*�:*�:*�:*�:*�|9�9�9�9�9�~�9�9�9�D���
�z���	�E�G�G�G�G�G��r