Your IP : 3.137.174.253


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

�

c��f�/����dZddlZddlZddlZddlZddlZddlmZddlm	Z	d�Z
ifd�Zifd�Zifd	�Z
d
�ZGd�dej��ZGd
�de	j��Zdd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreaderc�f�|���D]\}}|�||��}�|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�values    �7/opt/alt/python311/lib64/python3.11/xml/sax/saxutils.py�__dict_replacers7���g�g�i�i�"�"�
��U�
�I�I�c�5�!�!����H�c��|�dd��}|�dd��}|�dd��}|rt||��}|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��data�entitiess  r
�escapersY���<�<��W�%�%�D��<�<��V�$�$�D��<�<��V�$�$�D��.��d�H�-�-���Krc��|�dd��}|�dd��}|rt||��}|�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.
    rrrrrrrrs  r
�unescaper"sU���<�<���$�$�D��<�<���$�$�D��.��d�H�-�-���<�<���%�%�%rc��i|�dddd��}t||��}d|vr$d|vrd|�dd��z}nd	|z}nd|z}|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')rrrs  r
�	quoteattrr$0sr��G�(�F�'��v�F�F�F�H��$��!�!�D�
�d�{�{��$�;�;��D�L�L��h�7�7�7�D�D��D�=�D�D���}���Krc������ddl}|jSt�tj��r�St�t
jt
jf��r�St�tj��r"G�fd�d��}|��}d�|_	nQtj
��}d�|_�j|_	�j
|_
�j|_n#t$rYnwxYwtj||ddd�	��S)
Nrc�(��eZdZ�jZ�fd�ZdS)� _gettextwriter.<locals>._wrapperc�$��t�|��S�N)�getattr)�self�name�outs  �r
�__getattr__z,_gettextwriter.<locals>._wrapper.__getattr__Zs����s�D�)�)�)rN)�__name__�
__module__�__qualname__�	__class__r.)r-s�r
�_wrapperr'Xs5��������
�I�
*�
*�
*�
*�
*�
*�
*rr3c��dSr)�r5rr
�<lambda>z _gettextwriter.<locals>.<lambda>]s��t�rc��dS)NTr5r5rr
r6z _gettextwriter.<locals>.<lambda>bs��$�r�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r-r9r=r3�buffers`    r
�_gettextwriterrOGs8���
�{��
�
�
��z���#�r�}�%�%���
��#��+�V�-F�G�H�H���
��#�r�|�$�$��	*�	*�	*�	*�	*�	*�	*�	*�	*�	*������#�|�����"�$�$��&�,����y���	�"�l�F�O��(�F�K�K���	�	�	��D�	����
��F�X�#6�$(�*.�0�0�0�0s�7C�
C�Cc�f�eZdZdd�Zd�Zdd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�ZdS)�XMLGeneratorN�
iso-8859-1Fc��tj�|��t||��}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)N���F)r�ContentHandler�__init__rOrI�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r+r-r9�short_empty_elementss    r
rVzXMLGenerator.__init__rsy����'�'��-�-�-��S�(�+�+���i����i����D��� $� 1�"� 5���#%�� �!���%9��"�&+��#�#�#rc��|dr:d|dkrd|dzS|j|d}|r|dz|dzS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)r[)r+r,�prefixs   r
�_qnamezXMLGenerator._qname~sc����7�	.�
6��a��@�@���Q��'�'��*�4��7�3�F��
.���|�d�1�g�-�-��A�w�rc�P�|jr|�d��d|_dSdS)NrF�r_rW)r+�
endElements  r
�_finish_pending_start_elementz*XMLGenerator._finish_pending_start_element�s7���&�	0��K�K�����*/�D�'�'�'�	0�	0rc�@�|�d|jz��dS)Nz$<?xml version="1.0" encoding="%s"?>
)rWr]�r+s r
�
startDocumentzXMLGenerator.startDocument�s/�����;���'�	(�	(�	(�	(�	(rc�.�|���dSr))rYrjs r
�endDocumentzXMLGenerator.endDocument�s�����
�
�
�
�
rc��|j�|j�����||j|<|j�||f��dSr))rZ�appendr[�copyr\�r+rc�uris   r
�startPrefixMappingzXMLGenerator.startPrefixMapping�sV���� � ��!6�!;�!;�!=�!=�>�>�>�%+���c�"�� �'�'���
�6�6�6�6�6rc�:�|jd|_|jd=dS)NrT)rZr[�r+rcs  r
�endPrefixMappingzXMLGenerator.endPrefixMapping�s#�� $� 1�"� 5�����b�!�!�!rc	�,�|���|�d|z��|���D]-\}}|�d|�dt|�������.|jr	d|_dS|�d��dS)Nr� �=Tr)rhrWrr$r^r_)r+r,�attrsrs    r
�startElementzXMLGenerator.startElement�s����*�*�,�,�,����C�$�J����"�[�[�]�]�	=�	=�M�T�5��K�K�K�D�D�D�)�E�*:�*:�*:�;�<�<�<�<��%�	�*.�D�'�'�'��K�K������rc��|jr|�d��d|_dS|�d|z��dS�Nz/>Fz</%s>rf�r+r,s  r
rgzXMLGenerator.endElement�sI���&�	(��K�K�����*/�D�'�'�'��K�K��$��'�'�'�'�'rc	��|���|�d|�|��z��|jD]<\}}|r|�d|�d|�d����$|�d|z���=g|_|���D]@\}}|�d|�|���dt|�������A|jr	d|_dS|�d	��dS)
Nrz xmlns:z="r"z xmlns="%s"rxryTr)rhrWrdr\rr$r^r_)r+r,�qnamerzrcrrrs       r
�startElementNSzXMLGenerator.startElementNS�s"���*�*�,�,�,����C�$�+�+�d�+�+�+�,�,�,��3�	1�	1�K�F�C��
1�����������<�=�=�=�=����M�C�/�0�0�0�0�#%�� �"�[�[�]�]�	J�	J�M�T�5��K�K�K�D�K�K��$5�$5�$5�$5�y��7G�7G�7G�H�I�I�I�I��%�	�*.�D�'�'�'��K�K������rc��|jr|�d��d|_dS|�d|�|��z��dSr})r_rWrd�r+r,r�s   r
�endElementNSzXMLGenerator.endElementNS�sV���&�	5��K�K�����*/�D�'�'�'��K�K��$�+�+�d�"3�"3�3�4�4�4�4�4rc���|rb|���t|t��st||j��}|�t|����dSdSr))rhr?�strr]rWr�r+�contents  r
�
characterszXMLGenerator.characters�sg���	)��.�.�0�0�0��g�s�+�+�
7��g�t�~�6�6���K�K��w���(�(�(�(�(�		)�	)rc��|rU|���t|t��st||j��}|�|��dSdSr))rhr?r�r]rWr�s  r
�ignorableWhitespacez XMLGenerator.ignorableWhitespace�sa���	!��.�.�0�0�0��g�s�+�+�
7��g�t�~�6�6���K�K�� � � � � �		!�	!rc�f�|���|�d|�d|�d���dS)Nz<?rxz?>)rhrW�r+�targetrs   r
�processingInstructionz"XMLGenerator.processingInstruction�s;���*�*�,�,�,�����6�6�6�4�4�4�0�1�1�1�1�1r)NrRF)F)r/r0r1rVrdrhrkrmrsrvr{rgr�r�r�r�r�r5rr
rQrQps�������
,�
,�
,�
,����"0�0�0�0�(�(�(����7�7�7�
"�"�"����(�(�(����$5�5�5�)�)�)�!�!�!�2�2�2�2�2rrQc��eZdZdZdd�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�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.Nc�R�tj�|��||_dSr))r�	XMLReaderrV�_parent�r+�parents  r
rVzXMLFilterBase.__init__�s$����$�$�T�*�*�*�����rc�:�|j�|��dSr))�_err_handler�error�r+�	exceptions  r
r�zXMLFilterBase.error�s������	�*�*�*�*�*rc�:�|j�|��dSr))r��
fatalErrorr�s  r
r�zXMLFilterBase.fatalError�s����$�$�Y�/�/�/�/�/rc�:�|j�|��dSr))r��warningr�s  r
r�zXMLFilterBase.warning�s����!�!�)�,�,�,�,�,rc�:�|j�|��dSr))�
_cont_handler�setDocumentLocator)r+�locators  r
r�z XMLFilterBase.setDocumentLocator�s����-�-�g�6�6�6�6�6rc�8�|j���dSr))r�rkrjs r
rkzXMLFilterBase.startDocument�s����(�(�*�*�*�*�*rc�8�|j���dSr))r�rmrjs r
rmzXMLFilterBase.endDocuments����&�&�(�(�(�(�(rc�<�|j�||��dSr))r�rsrqs   r
rsz XMLFilterBase.startPrefixMappings!����-�-�f�c�:�:�:�:�:rc�:�|j�|��dSr))r�rvrus  r
rvzXMLFilterBase.endPrefixMappings����+�+�F�3�3�3�3�3rc�<�|j�||��dSr))r�r{)r+r,rzs   r
r{zXMLFilterBase.startElement�!����'�'��e�4�4�4�4�4rc�:�|j�|��dSr))r�rgr~s  r
rgzXMLFilterBase.endElements����%�%�d�+�+�+�+�+rc�>�|j�|||��dSr))r�r�)r+r,r�rzs    r
r�zXMLFilterBase.startElementNSs#����)�)�$��u�=�=�=�=�=rc�<�|j�||��dSr))r�r�r�s   r
r�zXMLFilterBase.endElementNSr�rc�:�|j�|��dSr))r�r�r�s  r
r�zXMLFilterBase.characterss����%�%�g�.�.�.�.�.rc�:�|j�|��dSr))r�r�)r+�charss  r
r�z!XMLFilterBase.ignorableWhitespaces����.�.�u�5�5�5�5�5rc�<�|j�||��dSr))r�r�r�s   r
r�z#XMLFilterBase.processingInstructions!����0�0���>�>�>�>�>rc�:�|j�|��dSr))r��
skippedEntityr~s  r
r�zXMLFilterBase.skippedEntity s����(�(��.�.�.�.�.rc�>�|j�|||��dSr))�_dtd_handler�notationDecl)r+r,�publicId�systemIds    r
r�zXMLFilterBase.notationDecl%s#����&�&�t�X�x�@�@�@�@�@rc�@�|j�||||��dSr))r��unparsedEntityDecl)r+r,r�r��ndatas     r
r�z XMLFilterBase.unparsedEntityDecl(s%����,�,�T�8�X�u�M�M�M�M�Mrc�8�|j�||��Sr))�_ent_handler�
resolveEntity)r+r�r�s   r
r�zXMLFilterBase.resolveEntity-s��� �.�.�x��B�B�Brc�
�|j�|��|j�|��|j�|��|j�|��|j�|��dSr))r��setContentHandler�setErrorHandler�setEntityResolver�
setDTDHandler�parse)r+�sources  r
r�zXMLFilterBase.parse2sv����&�&�t�,�,�,���$�$�T�*�*�*���&�&�t�,�,�,���"�"�4�(�(�(�����6�"�"�"�"�"rc�:�|j�|��dSr))r��	setLocale)r+�locales  r
r�zXMLFilterBase.setLocale9s������v�&�&�&�&�&rc�6�|j�|��Sr))r��
getFeaturer~s  r
r�zXMLFilterBase.getFeature<s���|�&�&�t�,�,�,rc�<�|j�||��dSr))r��
setFeature)r+r,�states   r
r�zXMLFilterBase.setFeature?s �������e�,�,�,�,�,rc�6�|j�|��Sr))r��getPropertyr~s  r
r�zXMLFilterBase.getPropertyBs���|�'�'��-�-�-rc�<�|j�||��dSr))r��setProperty)r+r,rs   r
r�zXMLFilterBase.setPropertyEs ���� � ��u�-�-�-�-�-rc��|jSr)�r�rjs r
�	getParentzXMLFilterBase.getParentJs
���|�rc��||_dSr)r�r�s  r
�	setParentzXMLFilterBase.setParentMs
������rr)) r/r0r1�__doc__rVr�r�r�r�rkrmrsrvr{rgr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r5rr
r�r��s�������������+�+�+�0�0�0�-�-�-�
7�7�7�+�+�+�)�)�)�;�;�;�4�4�4�5�5�5�,�,�,�>�>�>�5�5�5�/�/�/�6�6�6�?�?�?�/�/�/�
A�A�A�N�N�N�
C�C�C�
#�#�#�'�'�'�-�-�-�-�-�-�.�.�.�.�.�.�
�������rr��c���t|tj��rtj|��}t|t��rtj|��}n�t|d��r�|}tj��}t|�d��t��r|�	|��n|�
|��t|d��r4t|jt��r|�|j��|�
����C|�����.|���}tj�tj�|����}tj�||��}tj�|��r&|�|��t+|d��}nd|�t,j�||����t,j�|�����}|�
|��|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)r?�os�PathLike�fspathr�r�InputSource�hasattrr��setCharacterStream�
setByteStreamr,�setSystemId�getCharacterStream�
getByteStream�getSystemId�path�dirname�normpath�join�isfile�open�urllibr��urljoin�request�urlopen)r��base�f�sysid�basehead�
sysidfilenames      r
�prepare_input_sourcer�Rs����&�"�+�&�&�#���6�"�"���&�#���
'��&�v�.�.���	���	 �	 �'����&�(�(���a�f�f�Q�i�i��%�%�	$��%�%�a�(�(�(�(�� � ��#�#�#��1�f���	'�*�Q�V�S�"9�"9�	'����q�v�&�&�&�
� � �"�"�*�v�/C�/C�/E�/E�/M��"�"�$�$���7�?�?�2�7�#3�#3�D�#9�#9�:�:������X�u�5�5�
�
�7�>�>�-�(�(�	=����}�-�-�-��]�D�)�)�A�A����v�|�3�3�D�%�@�@�A�A�A���&�&�v�'9�'9�';�';�<�<�A����Q�����Mr)r�)r�r��urllib.parser��urllib.requestr@rBr�rrrrrr$rOrUrQr�r�r�r5rr
�<module>r�s_����
(�'�'�'�'�'�'�'�'�'�'�'�	�	�	�	�
�
�
�
�������������
�
�
������ �&�&�&�&� �����.'0�'0�'0�Rp2�p2�p2�p2�p2�7�)�p2�p2�p2�fk�k�k�k�k�I�'�k�k�k�^�����r

?>