AlkantarClanX12

Your IP : 18.217.207.112


Current Path : /opt/alt/python312/lib64/python3.12/xml/sax/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/xml/sax/__pycache__/expatreader.cpython-312.pyc

�

�Q�f�>����dZdZddl�ddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZ	dd	lm
Z
ee
d
�s	edd��dd
lmZmZmZej*Zej,Z	ddlZddlZej2Z[[Gd�d�ZGd�dej8�ZGd�dej<ej8�Zd�Z e!dk(ryddl"Z#e �Z$e$jKe#jLj&jO��e$jQe#jLjS��e$jUd�yy#e$r
edd��wxYw#e$rd�ZY��wxYw)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_dict)�expat�ParserCreatezexpat not supportedN)�	xmlreader�saxutils�handlerc��|S�N�)�os �:/opt/alt/python312/lib64/python3.12/xml/sax/expatreader.py�_mkproxyr!s����c��eZdZy)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr(s��rrc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�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.
    c�$�t|�|_yr)r�_ref��self�parsers  r�__init__zExpatLocator.__init__3s���V�$��	rc�`�|j}|j�y|jjSr)r �_parser�ErrorColumnNumberr!s  r�getColumnNumberzExpatLocator.getColumnNumber6s(�������>�>�!���~�~�/�/�/rc�`�|j}|j�y|jjS�N�)r r&�ErrorLineNumberr!s  r�
getLineNumberzExpatLocator.getLineNumber<s(�������>�>�!���~�~�-�-�-rc�T�|j}|�y|jj�Sr)r �_source�getPublicIdr!s  rr0zExpatLocator.getPublicIdB�&�������>���~�~�)�)�+�+rc�T�|j}|�y|jj�Sr)r r/�getSystemIdr!s  rr3zExpatLocator.getSystemIdHr1rN)	rrr�__doc__r$r(r-r0r3rrrrr-s ���
%�0�.�,�,rrc���eZdZdZd#d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd$d
�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!d �Z"d!�Z#y")%�ExpatParserz$SAX driver for the pyexpat C module.c���tjj||�tj�|_d|_||_d|_d|_g|_	d|_
d|_y)NFr)r�IncrementalParserr$�InputSourcer/r&�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)r"�namespaceHandling�bufsizes   rr$zExpatParser.__init__Ts]���#�#�,�,�T�7�;� �,�,�.������,���!%�����
���������rc��tj|�}||_	|j�|jjt
|��tjj||�y#|j��xYw)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer/�reset�
_cont_handler�setDocumentLocatorrrr8�parse�
_close_source�r"�sources  rrGzExpatParser.parseasn���.�.�v�6�����		��J�J�L����1�1�,�t�2D�E��'�'�-�-�d�F�;��	�
��� ��s�AA3�3Bc�x�|j��*|jj|j��yyr)r3r&�SetBaserIs  r�
prepareParserzExpatParser.prepareParserqs1������+��L�L� � ��!3�!3�!5�6�,rc�~�tjj||�|jr|j	�yyr)rr8�setContentHandlerr<�_reset_cont_handler)r"rs  rrOzExpatParser.setContentHandlerws0���#�#�5�5�d�G�D��=�=��$�$�&�rc���|tk(r|jS|tk(r|jduS|tt
tfvry|tk(r|jStd|z��)Nr�Feature '%s' not recognized)
rr:r	r?rrrrr>�SAXNotRecognizedException�r"�names  r�
getFeaturezExpatParser.getFeature|sn���%�%��#�#�#�
�-�
-��?�?�$�.�.�
�(�*>�0�2�2��
�)�
)��%�%�%�'�(E��(L�M�Mrc�j�|jrtd��|tk(r||_y|tk(r||_y|tk(r|r|j�i|_yd|_yy|tk(r|rtd��y|tk(r|rtd��y|tk(r|rtd��ytd|z��)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrR)r<�SAXNotSupportedExceptionrr:rr>r	r?rrrrS)r"rU�states   r�
setFeaturezExpatParser.setFeature�s����=�=�*�+N�O�O��%�%�$�D��
�)�
)�!&�D��
�-�
-���?�?�*�&(�D�O�"&���+��'�
'��.�7�9�9���)�
)��.�E�G�G���/�
/��.�>�@�@��,�-��4�6�
6rc�<�|tjk(r|jS|tk(r|jS|t
k(rR|jr;t|jd�r|jj�Std��td��td|z��)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;rr?r
r&�hasattrr\rSrXrTs  r�getPropertyzExpatParser.getProperty�s����7�3�3�3��)�)�)�
�,�
,��?�?�"�
�(�
(��|�|��4�<�<�):�;��<�<�7�7�9�9�3�*�+�+�/�D�F�F�'�(F��(M�N�Nrc���|tjk(r%||_|jr|j	�yy|t
k(r||_y|tk(rtd|z��td|z��)NzProperty '%s' cannot be setr])
rr^r;r<�_reset_lex_handler_proprr?r
rXrS)r"rU�values   r�setPropertyzExpatParser.setProperty�s{���7�3�3�3�%*�D�"��}�}��,�,�.��
�,�
,�#�D�O�
�(�
(�*�+H�+/�,0�1�
1�,�,J�,0�-1�2�
2rc��|js1|j�d|_|jj�	|jj||�y#tj$rO}tt
j|j�||�}|jj|�Yd}~yd}~wwxYw)NT)
r<rDrE�
startDocumentr&�Parser�error�SAXParseException�ErrorString�code�_err_handler�
fatalError)r"�data�isFinal�e�excs     r�feedzExpatParser.feed�s����}�}��J�J�L� �D�M����,�,�.�		.�

�L�L���t�W�-���{�{�	.�#�E�$5�$5�a�f�f�$=�q�$�G�C����(�(��-�-��	.�s�A�B>�/AB9�9B>c��|j�y|jj�}	|jjd�|jjdd�|jj|�y#tj
$rO}t
t	j|j�||�}|jj|�Yd}~�yd}~wwxYw#|jj|�wxYw)NFr)r&�GetReparseDeferralEnabled�SetReparseDeferralEnabledrgrrhrirjrkrlrm)r"�was_enabledrprqs    r�flushzExpatParser.flush�s����<�<����l�l�<�<�>��	@��L�L�2�2�5�9��L�L���s�E�*�

�L�L�2�2�;�?��	�{�{�	.�#�E�$5�$5�a�f�f�$=�q�$�G�C����(�(��-�-��	.��
�L�L�2�2�;�?�s*�7A<�<C�AC�C!�C�C!�!C>c��|j}	|j�}|�|j�|j�}|�|j�yy#|j�}|�|j�wwxYwr)r/�getCharacterStream�close�
getByteStream)r"rJ�files   rrHzExpatParser._close_source�su������	��,�,�.�D����
�
���'�'�)�D����
�
�� ���'�'�)�D����
�
�� �s�"A�%A9c��|js&|j�t|jt�ry	|j	dd��|j
j
�d|_d|_d|_|j�Gt�}|jj|_|jj|_	||_|j�y#d|_|j�Gt�}|jj|_|jj|_	||_|j�wxYw)NrT)roF)r=r&�
isinstancerrrrE�endDocumentr<r'r,rHr!s  rrzzExpatParser.close�s������$�,�,�"6��t�|�|�]�3��	!��I�I�c�4�I�(����*�*�,�!�D�M��D�L�!�D�M��|�|�'�&���+/�<�<�+I�+I��(�)-���)E�)E��&�%������ ��"�D�M��|�|�'�&���+/�<�<�+I�+I��(�)-���)E�)E��&�%������ �s�;C�A,Ec��|jj|j_|jj|j_yr)rE�processingInstructionr&�ProcessingInstructionHandler�
characters�CharacterDataHandler�r"s rrPzExpatParser._reset_cont_handlers5��$(�$6�$6�$L�$L�	
���1�,0�,>�,>�,I�,I����)rc�*�|j}|j}|�$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr)r;r&�CommentHandler�StartCdataSectionHandler�EndCdataSectionHandler�StartDoctypeDeclHandler�EndDoctypeDeclHandler�comment�
startCDATA�endCDATA�start_doctype_decl�endDTD)r"�lexr#s   rrbz#ExpatParser._reset_lex_handler_props����$�$�������;�$(�F�!�.2�F�+�,0�F�)�-1�F�*�+/�F�(�$'�K�K�F�!�.1�n�n�F�+�,/�L�L�F�)�-1�-D�-D�F�*�+.�:�:�F�(rc�J�|jr�tj|jj	�d|j
��|_d|j_|j|j_	|j|j_nttj|jj	�|j
��|_|j|j_	|j|j_|j�|j|j_|j"|j_|j&|j_|j*|j_d|_|j0r|j3�|j4|j_	|j8|j_|jj?tj@�d|_!g|_"y#t<$rY�CwxYw)N� )�internr+F)#r:rr
r/�getEncodingr?r&�namespace_prefixes�start_element_ns�StartElementHandler�end_element_ns�EndElementHandler�
start_element�end_elementrP�unparsed_entity_decl�UnparsedEntityDeclHandler�
notation_decl�NotationDeclHandler�start_namespace_decl�StartNamespaceDeclHandler�end_namespace_decl�EndNamespaceDeclHandler�_decl_handler_propr;rb�external_entity_ref�ExternalEntityRefHandler�skipped_entity_handler�SkippedEntityHandler�AttributeError�SetParamEntityParsing�*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr<r=r�s rrDzExpatParser.resets������ �-�-�d�l�l�.F�.F�.H�#�59�_�_�F�D�L�./�D�L�L�+�/3�/D�/D�D�L�L�,�-1�-@�-@�D�L�L�*� �-�-�d�l�l�.F�.F�.H�7;���H�D�L�/3�/A�/A�D�L�L�,�-1�-=�-=�D�L�L�*�� � �"�15�1J�1J����.�+/�+=�+=����(�15�1J�1J����.�/3�/F�/F����,�"&����!�!��(�(�*�15�0H�0H����-�	�04�0K�0K�D�L�L�-�	
���*�*��<�<�	>���
������	��	�s�H�	H"�!H"c�H�|j�y|jjSr)r&r'r�s rr(zExpatParser.getColumnNumberCs���<�<����|�|�-�-�-rc�H�|j�y|jjSr*)r&r,r�s rr-zExpatParser.getLineNumberHs���<�<����|�|�+�+�+rc�6�|jj�Sr)r/r0r�s rr0zExpatParser.getPublicIdM����|�|�'�'�)�)rc�6�|jj�Sr)r/r3r�s rr3zExpatParser.getSystemIdPr�rc�N�|jj|t|��yr)rE�startElement�AttributesImpl)r"rU�attrss   rr�zExpatParser.start_elementTs�����'�'��n�U�.C�Drc�:�|jj|�yr)rE�
endElementrTs  rr�zExpatParser.end_elementW������%�%�d�+rc���|j�}t|�dk(rd|f}n$t|�dk(r|d|df}nt|�}i}i}|j�D]c\}}|j�}t|�}	|	dk(r|}
d|f}n-|	dk(r|d�d|d��}
|d|df}n|d}
t|�}|||<|
||<�e|jj|dt
||��y)Nr+�r��:)�split�len�tuple�itemsrE�startElementNS�AttributesNSImpl)r"rUr��pair�newattrs�qnames�anamerc�parts�length�qname�apairs            rr�zExpatParser.start_element_nsZs���z�z�|���t�9��>��$�<�D�
��Y�!�^���7�D��G�#�D���;�D�����#�k�k�m�N�U�E��K�K�M�E���Z�F���{����u�
���1��#(��8�U�1�X�6���a��%��(�*���a����e���#�H�U�O�!�F�5�M�!,�$	
���)�)�$��*:�8�V�*L�	Nrc���|j�}t|�dk(rd|f}n$t|�dk(r|d|df}nt|�}|jj	|d�y)Nr+r�r)r�r�r�rE�endElementNS)r"rUr�s   rr�zExpatParser.end_element_ns|s]���z�z�|���t�9��>��$�<�D�
��Y�!�^���7�D��G�#�D���;�D����'�'��d�3rc�<�|jj||�yr)rEr�)r"�targetrns   r�processing_instructionz"ExpatParser.processing_instruction�s�����0�0���>rc�:�|jj|�yr)rEr�)r"rns  r�character_datazExpatParser.character_data�r�rc�<�|jj||�yr)rE�startPrefixMapping)r"�prefix�uris   rr�z ExpatParser.start_namespace_decl�s�����-�-�f�c�:rc�:�|jj|�yr)rE�endPrefixMapping)r"r�s  rr�zExpatParser.end_namespace_decl�s�����+�+�F�3rc�>�|jj|||�yr)r;�startDTD)r"rU�sysid�pubid�has_internal_subsets     rr�zExpatParser.start_doctype_decl�s�����'�'��e�U�;rc�@�|jj||||�yr)�_dtd_handler�unparsedEntityDecl)r"rU�baser�r��
notation_names      rr�z ExpatParser.unparsed_entity_decl�s�����,�,�T�5�%��Orc�>�|jj|||�yr)r��notationDecl)r"rUr�r�r�s     rr�zExpatParser.notation_decl�s�����&�&�t�U�E�:rc��|jsy|jj||�}tj||j
j
�xsd�}|jj|j|j
f�|jj|�|_	||_	tjj||�|jd\|_	|_|jd=y#YyxYw)Nr+�r���)r>�_ent_handler�
resolveEntityrrCr/r3r=�appendr&�ExternalEntityParserCreaterr8rG)r"�contextr�r�r�rJs      rr�zExpatParser.external_entity_ref�s����!�!���"�"�0�0���>���.�.�v�/3�|�|�/G�/G�/I�02�/1�3��	
���!�!�4�<�<����">�?��|�|�>�>�w�G������	��'�'�-�-�d�F�;�(,�'9�'9�"�'=�$���t�|����r�"���	��s�5 C?�?Dc�H�|rd|z}|jj|�y)N�%)rE�
skippedEntity)r"rU�is_pes   rr�z"ExpatParser.skipped_entity_handler�s"����t�8�D����(�(��.rN)ri�)F)$rrrr4r$rGrMrOrVrZr`rdrrrwrHrzrPrbrDr(r-r0r3r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr6r6Qs���.�	�� 7�'�

N�6�<O�$2� .�"@�	�!�*J�
6� # �N.�
,�
*�*�E�,� N�D	4�?�,�;�4�<�P�;��,/rr6c��t|i|��Sr)r6)�args�kwargss  r�
create_parserr��s����'��'�'r�__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)+r4�version�xml.sax._exceptions�xml.sax.handlerrrrrrr	r
r�xml.parsersrr_�SAXReaderNotAvailable�ImportError�xml.saxrrrr�r��_weakref�weakref�proxyrr�Locatorrr8r6r�r�xml.sax.saxutils�xml�prO�sax�XMLGenerator�setErrorHandler�ErrorHandlerrGrrr�<module>rsT���
��!�B�6�F�4�H�A�!��5�.�)�#�$9�4�@�@�0�0��)�)���-�-��
��
��}�}�H���	�	�
,�9�$�$�,�Hg/�)�-�-�y�/@�/@�g/�V(�
�z�����A�������(�(�5�5�7�8����c�g�g�*�*�,�-��G�G�H�I���a
�=�
� 5�t�
<�<�=������s�E�*E�E�E�E