%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__/saxutils.cpython-312.pyc

�

���f�/����dZddlZddlZddlZddlZddlZddlmZddlm	Z	d�Z
ifd�Zifd�Zifd	�Z
d
�ZGd�dej�ZGd
�de	j"�Zdd�Zy)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreaderc�Z�|j�D]\}}|j||�}�|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�values    �'/usr/lib/python3.12/xml/sax/saxutils.py�__dict_replacers0���g�g�i�"�
��U�
�I�I�c�5�!��"��H�c��|jdd�}|jdd�}|jdd�}|rt||�}|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
�escapersH���<�<��W�%�D��<�<��V�$�D��<�<��V�$�D���d�H�-���Krc��|jdd�}|jdd�}|rt||�}|jdd�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"sD���<�<���$�D��<�<���$�D���d�H�-���<�<���%�%rc��i|�dddd��}t||�}d|vr"d|vrd|jdd�z}|Sd	|z}|Sd|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$0sp��G�(�F�'��v�F�H��$��!�D�
�d�{��$�;��D�L�L��h�7�7�D�
�K��D�=�D��K���}���Krc�����ddl}|jSt�tj�r�St�t
jt
jf�r�St�tj�rG�fd�d�}|�}d�|_	nPtj�}d�|_�j|_	�j|_
�j|_tj ||ddd�	�S#t$rY�%wxYw)
Nrc�2��eZdZW�jZ�fd�Zy)� _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'Xs����
�
�I�
*rr3c��yr)�r5rr
�<lambda>z _gettextwriter.<locals>.<lambda>]��rc��y)NTr5r5rr
r6z _gettextwriter.<locals>.<lambda>br7r�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r-r:r>r3�buffers`    r
�_gettextwriterrPGs����
�{���z�z���#�r�}�}�%��
��#��+�+�V�-F�-F�G�H��
��#�r�|�|�$�	*�	*����#����"�"�$��&����y�y���	�"�l�l�F�O��(�(�F�K����F�X�#6�$(�*.�0�0���	��	�s�"C<�<	D�Dc�d�eZdZdd�Zd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zy)�XMLGeneratorNc��tjj|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
y)N���F)r�ContentHandler�__init__rPrJ�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r+r-r:�short_empty_elementss    r
rVzXMLGenerator.__init__rst�����'�'��-��S�(�+���i�i����i�i����D��� $� 1� 1�"� 5���#%�� �!���%9��"�&+��#rc�t�|dr/d|dk(rd|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~sY����7�
6��a��@���Q��'�'��*�*�4��7�3�F����|�d�1�g�-�-��A�w�rc�N�|jr|jd�d|_yy)NrF�r_rW)r+�
endElements  r
�_finish_pending_start_elementz*XMLGenerator._finish_pending_start_element�s$���&�&��K�K���*/�D�'�'rc�@�|jd|jz�y)Nz$<?xml version="1.0" encoding="%s"?>
)rWr]�r+s r
�
startDocumentzXMLGenerator.startDocument�s�����;����'�	(rc�$�|j�yr))rYrjs r
�endDocumentzXMLGenerator.endDocument�s�����
rc���|jj|jj��||j|<|jj||f�yr))rZ�appendr[�copyr\�r+rc�uris   r
�startPrefixMappingzXMLGenerator.startPrefixMapping�sM����� � ��!6�!6�!;�!;�!=�>�%+����c�"�� � �'�'���
�6rc�F�|jd|_|jd=y)NrT)rZr[�r+rcs  r
�endPrefixMappingzXMLGenerator.endPrefixMapping�s#�� $� 1� 1�"� 5������b�!rc	��|j�|jd|z�|j�D]%\}}|jd|�dt|�����'|jrd|_y|jd�y)Nr� �=Tr)rhrWrr$r^r_)r+r,�attrsrs    r
�startElementzXMLGenerator.startElement�sj���*�*�,����C�$�J��"�[�[�]�	=�M�T�5��K�K�D�)�E�*:�;�<�	=��%�%�*.�D�'��K�K��rc�v�|jr|jd�d|_y|jd|z�y�Nz/>Fz</%s>rf�r+r,s  r
rgzXMLGenerator.endElement�s/���&�&��K�K���*/�D�'��K�K��$��'rc	���|j�|jd|j|�z�|jD]4\}}|r|jd|�d|�d���!|jd|z��6g|_|j	�D]4\}}|jd|j|��dt|�����6|jrd|_y|jd	�y)
Nrz xmlns:z="r"z xmlns="%s"rxryTr)rhrWrdr\rr$r^r_)r+r,�qnamerzrcrrrs       r
�startElementNSzXMLGenerator.startElementNS�s����*�*�,����C�$�+�+�d�+�+�,��3�3�	1�K�F�C�������<�=����M�C�/�0�		1�
$&�� �"�[�[�]�	J�M�T�5��K�K�D�K�K��$5�y��7G�H�I�	J��%�%�*.�D�'��K�K��rc��|jr|jd�d|_y|jd|j|�z�yr})r_rWrd�r+r,r�s   r
�endElementNSzXMLGenerator.endElementNS�s9���&�&��K�K���*/�D�'��K�K��$�+�+�d�"3�3�4rc��|rQ|j�t|t�st||j�}|j	t|��yyr))rhr@�strr]rWr�r+�contents  r
�
characterszXMLGenerator.characters�s@����.�.�0��g�s�+��g�t�~�~�6���K�K��w��(�	rc��|rH|j�t|t�st||j�}|j	|�yyr))rhr@r�r]rWr�s  r
�ignorableWhitespacez XMLGenerator.ignorableWhitespace�s<����.�.�0��g�s�+��g�t�~�~�6���K�K�� �	rc�T�|j�|jd|�d|�d��y)Nz<?rxz?>)rhrW�r+�targetrs   r
�processingInstructionz"XMLGenerator.processingInstruction�s���*�*�,����6�4�0�1r)Nz
iso-8859-1F)F)r/r0r1rVrdrhrkrmrsrvr{rgr�r�r�r�r�r5rr
rRrRpsH��
,��"0�(��7�
"��(��$5�)�!�2rrRc��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�Zy) �
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�P�tjj|�||_yr))r�	XMLReaderrV�_parent�r+�parents  r
rVzXMLFilterBase.__init__�s�����$�$�T�*���rc�:�|jj|�yr))�_err_handler�error�r+�	exceptions  r
r�zXMLFilterBase.error�s�������	�*rc�:�|jj|�yr))r��
fatalErrorr�s  r
r�zXMLFilterBase.fatalError�s�����$�$�Y�/rc�:�|jj|�yr))r��warningr�s  r
r�zXMLFilterBase.warning�s�����!�!�)�,rc�:�|jj|�yr))�
_cont_handler�setDocumentLocator)r+�locators  r
r�z XMLFilterBase.setDocumentLocator�s�����-�-�g�6rc�8�|jj�yr))r�rkrjs r
rkzXMLFilterBase.startDocument�s�����(�(�*rc�8�|jj�yr))r�rmrjs r
rmzXMLFilterBase.endDocuments�����&�&�(rc�<�|jj||�yr))r�rsrqs   r
rsz XMLFilterBase.startPrefixMappings�����-�-�f�c�:rc�:�|jj|�yr))r�rvrus  r
rvzXMLFilterBase.endPrefixMappings�����+�+�F�3rc�<�|jj||�yr))r�r{)r+r,rzs   r
r{zXMLFilterBase.startElement������'�'��e�4rc�:�|jj|�yr))r�rgr~s  r
rgzXMLFilterBase.endElements�����%�%�d�+rc�>�|jj|||�yr))r�r�)r+r,r�rzs    r
r�zXMLFilterBase.startElementNSs�����)�)�$��u�=rc�<�|jj||�yr))r�r�r�s   r
r�zXMLFilterBase.endElementNSr�rc�:�|jj|�yr))r�r�r�s  r
r�zXMLFilterBase.characterss�����%�%�g�.rc�:�|jj|�yr))r�r�)r+�charss  r
r�z!XMLFilterBase.ignorableWhitespaces�����.�.�u�5rc�<�|jj||�yr))r�r�r�s   r
r�z#XMLFilterBase.processingInstructions�����0�0���>rc�:�|jj|�yr))r��
skippedEntityr~s  r
r�zXMLFilterBase.skippedEntity s�����(�(��.rc�>�|jj|||�yr))�_dtd_handler�notationDecl)r+r,�publicId�systemIds    r
r�zXMLFilterBase.notationDecl%s�����&�&�t�X�x�@rc�@�|jj||||�yr))r��unparsedEntityDecl)r+r,r�r��ndatas     r
r�z XMLFilterBase.unparsedEntityDecl(s�����,�,�T�8�X�u�Mrc�:�|jj||�Sr))�_ent_handler�
resolveEntity)r+r�r�s   r
r�zXMLFilterBase.resolveEntity-s��� � �.�.�x��B�Brc��|jj|�|jj|�|jj|�|jj	|�|jj|�yr))r��setContentHandler�setErrorHandler�setEntityResolver�
setDTDHandler�parse)r+�sources  r
r�zXMLFilterBase.parse2s\�����&�&�t�,����$�$�T�*����&�&�t�,����"�"�4�(������6�"rc�:�|jj|�yr))r��	setLocale)r+�locales  r
r�zXMLFilterBase.setLocale9s�������v�&rc�8�|jj|�Sr))r��
getFeaturer~s  r
r�zXMLFilterBase.getFeature<s���|�|�&�&�t�,�,rc�<�|jj||�yr))r��
setFeature)r+r,�states   r
r�zXMLFilterBase.setFeature?s��������e�,rc�8�|jj|�Sr))r��getPropertyr~s  r
r�zXMLFilterBase.getPropertyBs���|�|�'�'��-�-rc�<�|jj||�yr))r��setProperty)r+r,rs   r
r�zXMLFilterBase.setPropertyEs����� � ��u�-rc��|jSr)�r�rjs r
�	getParentzXMLFilterBase.getParentJs���|�|�rc��||_yr)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�-�
7�+�)�;�4�5�,�>�5�/�6�?�/�
A�N�
C�
#�'�-�-�.�.�
�rr�c�j�t|tj�rtj|�}t|t�rtj|�}n�t|d�r�|}tj�}t|jd�t�r|j|�n|j|�t|d�r5t|jt�r|j|j�|j���'|j���|j�}tj j#tj j%|��}tj j'||�}tj j)|�r|j|�t+|d�}n\|jt,j.j1||��t,j2j5|j��}|j|�|S)z�This function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.�readrr,�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��%��%�%�a�(�� � ��#��1�f��*�Q�V�V�S�"9����q�v�v�&�
� � �"�*�v�/C�/C�/E�/M��"�"�$���7�7�?�?�2�7�7�#3�#3�D�#9�:�������X�u�5�
�
�7�7�>�>�-�(����}�-��]�D�)�A����v�|�|�3�3�D�%�@�A����&�&�v�'9�'9�';�<�A����Q���Mr)�)r�r��urllib.parser��urllib.requestrArCr�rrrrrr$rPrUrRr�r�r�r5rr
�<module>r�sv���
(�'�	�
���
��� �&� ��.'0�Rp2�7�)�)�p2�fk�I�'�'�k�^r

Zerion Mini Shell 1.0