%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/xml/sax/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/xml/sax/__pycache__/xmlreader.cpython-312.pyc

�

���fP1���dZddlmZddlmZmZGd�d�ZGd�de�ZGd�d	�ZGd
�d�Z	Gd�d
�Z
Gd�de
�Zd�Ze
dk(re�yy)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. �)�handler)�SAXNotSupportedException�SAXNotRecognizedExceptionc�j�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�	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�|_y�N)	r�ContentHandler�
_cont_handler�
DTDHandler�_dtd_handler�EntityResolver�_ent_handler�ErrorHandler�_err_handler��selfs �(/usr/lib/python3.12/xml/sax/xmlreader.py�__init__zXMLReader.__init__sF��$�3�3�5���#�.�.�0���#�2�2�4���#�0�0�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�Erc��|jS)z#Returns the current ContentHandler.�rrs r�getContentHandlerzXMLReader.getContentHandler"s���!�!�!rc��||_y)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��||_y)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��||_y)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��||_y)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�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�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�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�rrrrsX��
�3�F�"�%�!�$�!�%�!�$�I�N�N�O�Orrc�6�eZdZdZd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�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�<�||_tj|�yr	)�_bufsizerr)r�bufsizes  rrzIncrementalParser.__init__os����
����4� rc�P�ddlm}|j|�}|j|�|j	�}|�|j�}|j
|j�x}r/|j|�|j
|j�x}r�/|j�y)Nr)�saxutils)
�rU�prepare_input_source�
prepareParser�getCharacterStream�
getByteStream�readrR�feed�close)rrrU�file�buffers     rrzIncrementalParser.parsess�����.�.�v�6�����6�"��(�(�*���<��'�'�)�D��	�	�$�-�-�0�0�f�0��I�I�f���	�	�$�-�-�0�0�f�0��
�
�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.feeds��"�"D�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  rrXzIncrementalParser.prepareParser�s��"�"E�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�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�ErN)i)
rJrKrLrMrrr\rXr]rerNrrrPrP[s)���&!�
�F�G�
F�FrrPc�(�eZdZdZd�Zd�Zd�Zd�Zy)�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��y)z6Return the column number where the current event ends.���rNrs r�getColumnNumberzLocator.getColumnNumber����rc��y)z4Return the line number where the current event ends.rirNrs r�
getLineNumberzLocator.getLineNumber�rkrc��y)z3Return the public identifier for the current event.NrNrs r�getPublicIdzLocator.getPublicId����rc��y)z3Return the system identifier for the current event.NrNrs r�getSystemIdzLocator.getSystemId�rprN)rJrKrLrMrjrmrorrrNrrrgrg�s��"�
���rrgc�T�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)�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�J�||_d|_d|_d|_d|_yr	)�_InputSource__system_id�_InputSource__public_id�_InputSource__encoding�_InputSource__bytefile�_InputSource__charfile�r�	system_ids  rrzInputSource.__init__�s'��$��������������rc��||_y)z/Sets the public identifier of this InputSource.N�rw)r�	public_ids  r�setPublicIdzInputSource.setPublicId��
��$��rc��|jS)z2Returns the public identifier of this InputSource.r~rs rrozInputSource.getPublicId�������rc��||_y)z/Sets the system identifier of this InputSource.N�rvr{s  r�setSystemIdzInputSource.setSystemId�r�rc��|jS)z2Returns the system identifier of this InputSource.r�rs rrrzInputSource.getSystemId�r�rc��||_y)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�rx)r�encodings  r�setEncodingzInputSource.setEncoding����#��rc��|jS)z/Get the character encoding of this InputSource.r�rs r�getEncodingzInputSource.getEncoding�������rc��||_y)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�ry)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 rrZzInputSource.getByteStream�s��
���rc��||_y)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�rz)r�charfiles  r�setCharacterStreamzInputSource.setCharacterStreamr�rc��|jS)z/Get the character stream for this input source.r�rs rrYzInputSource.getCharacterStreamr�rr	)rJrKrLrMrr�ror�rrr�r�r�rZr�rYrNrrrtrt�s?��
B� �%� �%� �#��#��#�rrtc�t�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zd�Zd�Zy)�AttributesImplc��||_y)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��y)N�CDATArNr<s  r�getTypezAttributesImpl.getTypes��rc� �|j|Sr	r�r<s  r�getValuezAttributesImpl.getValue"����{�{�4� � rc� �|j|Sr	r�r<s  r�getValueByQNamezAttributesImpl.getValueByQName%r�rc�8�||jvrt|��|Sr	�r��KeyErrorr<s  r�getNameByQNamezAttributesImpl.getNameByQName(����t�{�{�"��4�.� ��rc�8�||jvrt|��|Sr	r�r<s  r�getQNameByNamezAttributesImpl.getQNameByName-r�rc�H�t|jj��Sr	��listr��keysrs r�getNameszAttributesImpl.getNames2����D�K�K�$�$�&�'�'rc�H�t|jj��Sr	r�rs r�	getQNameszAttributesImpl.getQNames5r�rc�,�t|j�Sr	r�rs r�__len__zAttributesImpl.__len__8r�rc� �|j|Sr	r�r<s  r�__getitem__zAttributesImpl.__getitem__;r�rc�H�t|jj��Sr	r�rs rr�zAttributesImpl.keys>r�rc��||jvSr	r�r<s  r�__contains__zAttributesImpl.__contains__As���t�{�{�"�"rNc�:�|jj||�Sr	)r��get)rr=�alternatives   rr�zAttributesImpl.getDs���{�{���t�[�1�1rc�8�|j|j�Sr	)�	__class__r�rs r�copyzAttributesImpl.copyGs���~�~�d�k�k�*�*rc�H�t|jj��Sr	)r�r��itemsrs rr�zAttributesImpl.itemsJs���D�K�K�%�%�'�(�(rc�H�t|jj��Sr	)r�r��valuesrs rr�zAttributesImpl.valuesMs���D�K�K�&�&�(�)�)rr	)rJrKrLrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rNrrr�r�sW��� ��!�!��
�
(�(� �!�(�#�2�+�)�*rr�c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�AttributesNSImplc� �||_||_y)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__Ts��
�����rc��|jj�D]\}}||k(s�|j|cSt|��r	)r�r�r�r��rr=�nsname�qnames    rr�z AttributesNSImpl.getValueByQName\sD��#�|�|�1�1�3�	+�O�V�U���}��{�{�6�*�*�	+��t�n�rc�n�|jj�D]\}}||k(s�|cSt|��r	)r�r�r�r�s    rr�zAttributesNSImpl.getNameByQNamecs:��#�|�|�1�1�3�	�O�V�U���}��
�	��t�n�rc� �|j|Sr	)r�r<s  rr�zAttributesNSImpl.getQNameByNamejs���|�|�D�!�!rc�H�t|jj��Sr	)r�r�r�rs rr�zAttributesNSImpl.getQNamesms���D�L�L�'�'�)�*�*rc�N�|j|j|j�Sr	)r�r�r�rs rr�zAttributesNSImpl.copyps���~�~�d�k�k�4�<�<�8�8rN)	rJrKrLrr�r�r�r�r�rNrrr�r�Rs �����"�+�9rr�c�@�t�t�t�yr	)rrPrgrNrr�_testr�ts��
�K����Ir�__main__N)rMrVr�_exceptionsrrrrPrgrtr�r�r�rJrNrr�<module>r�sz��"��L�
NO�NO�`DF�	�DF�P��0U�U�r:*�:*�|9�~�9�D�
�z��	�G�r

Zerion Mini Shell 1.0