Your IP : 18.117.168.40


Current Path : /opt/alt/python310/lib64/python3.10/xml/sax/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/xml/sax/__pycache__/saxutils.cpython-310.opt-2.pyc

o

6��f�/�@s�	ddlZddlZddlZddlZddlZddlmZddlmZdd�Z	ifdd�Z
ifd	d
�Zifdd�Zd
d�Z
Gdd�dej�ZGdd�dej�Zddd�ZdS)�N�)�handler)�	xmlreadercCs$	|��D]
\}}|�||�}q|S�N)�items�replace)�s�d�key�value�r�7/opt/alt/python310/lib64/python3.10/xml/sax/saxutils.py�__dict_replacesrcCs8	|�dd�}|�dd�}|�dd�}|rt||�}|S)N�&�&amp;�>�&gt;�<�&lt;�rr��dataZentitiesrrr
�escapes
rcCs4	|�dd�}|�dd�}|rt||�}|�dd�S)Nrrrrrrrrrrr
�unescape"s
rcCs\	i|�dddd��}t||�}d|vr(d|vr"d|�dd�}|Sd	|}|Sd|}|S)
Nz&#10;z&#13;z&#9;)�
�
�	�"�'z"%s"z&quot;z'%s')rrrrrr
�	quoteattr0s

��rcs��durddl}|jSt�tj�r�St�tjtjf�r�St�tj�r6G�fdd�d�}|�}dd�|_	n!t�
�}dd�|_�j|_z
�j
|_
�j|_Wn	tyVYnwtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�Sr)�getattr��self�name��outrr
�__getattr__Z�
z,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r&rr$rr
�_wrapperXsr,cSsdSrrrrrr
�<lambda>]�z _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrr
r-br.�xmlcharrefreplacerT)�encoding�errors�newline�
write_through)�sys�stdout�
isinstance�io�
TextIOBase�codecs�StreamWriter�StreamReaderWriter�	RawIOBase�close�BufferedIOBase�writable�write�seekable�tell�AttributeError�
TextIOWrapper)r%r0r4r,�bufferrr$r
�_gettextwriterGs2
��rFc@s�eZdZd dd�Zdd�Zd!dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)"�XMLGeneratorN�
iso-8859-1FcCsVtj�|�t||�}|j|_|j|_ig|_|jd|_	g|_
||_||_d|_
dS)N���F)r�ContentHandler�__init__rFr@�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r"r%r0Zshort_empty_elementsrrr
rKrs

zXMLGenerator.__init__cCsL	|dr"d|dkrd|dS|j|d}|r"|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rP)r"r#�prefixrrr
�_qname~szXMLGenerator._qnamecCs|jr
|�d�d|_dSdS)NrF�rTrL)r"�
endElementrrr
�_finish_pending_start_element�s

�z*XMLGenerator._finish_pending_start_elementcCs|�d|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rLrR�r"rrr
�
startDocument�s
�zXMLGenerator.startDocumentcCs|��dSr)rNr[rrr
�endDocument��zXMLGenerator.endDocumentcCs0|j�|j���||j|<|j�||f�dSr)rO�appendrP�copyrQ�r"rV�urirrr
�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrI)rOrP�r"rVrrr
�endPrefixMapping�szXMLGenerator.endPrefixMappingcCs\|��|�d|�|��D]\}}|�d|t|�f�q|jr'd|_dS|�d�dS)Nr� %s=%sTr)rZrLrrrSrT)r"r#�attrsrrrr
�startElement�s
zXMLGenerator.startElementcCs,|jr
|�d�d|_dS|�d|�dS�Nz/>Fz</%s>rXr!rrr
rY�s

zXMLGenerator.endElementcCs�|��|�d|�|��|jD]\}}|r!|�d||f�q|�d|�qg|_|��D]\}}|�d|�|�t|�f�q0|jrKd|_dS|�d�dS)Nrz xmlns:%s="%s"z xmlns="%s"rfTr)rZrLrWrQrrrSrT)r"r#�qnamergrVrbrrrr
�startElementNS�s
zXMLGenerator.startElementNScCs2|jr
|�d�d|_dS|�d|�|��dSri)rTrLrW�r"r#rjrrr
�endElementNS�s

zXMLGenerator.endElementNScCs8|r|��t|t�st||j�}|�t|��dSdSr)rZr6�strrRrLr�r"Zcontentrrr
�
characters�s
�zXMLGenerator.characterscCs4|r|��t|t�st||j�}|�|�dSdSr)rZr6rnrRrLrorrr
�ignorableWhitespace�s
�z XMLGenerator.ignorableWhitespacecCs|��|�d||f�dS)Nz	<?%s %s?>)rZrL�r"�targetrrrr
�processingInstruction�sz"XMLGenerator.processingInstruction)NrHF)F)r(r)r*rKrWrZr\r]rcrerhrYrkrmrprqrtrrrr
rGps


rGc@s�eZdZ	d:dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS);�
XMLFilterBaseNcCstj�|�||_dSr)r�	XMLReaderrK�_parent�r"�parentrrr
rK�s
zXMLFilterBase.__init__cC�|j�|�dSr)�_err_handler�error�r"Z	exceptionrrr
r|��zXMLFilterBase.errorcCrzr)r{�
fatalErrorr}rrr
r�r~zXMLFilterBase.fatalErrorcCrzr)r{�warningr}rrr
r��r~zXMLFilterBase.warningcCrzr)�
_cont_handler�setDocumentLocator)r"Zlocatorrrr
r��r~z XMLFilterBase.setDocumentLocatorcC�|j��dSr)r�r\r[rrr
r\��zXMLFilterBase.startDocumentcCr�r)r�r]r[rrr
r]r�zXMLFilterBase.endDocumentcC�|j�||�dSr)r�rcrarrr
rc�z XMLFilterBase.startPrefixMappingcCrzr)r�rerdrrr
rer~zXMLFilterBase.endPrefixMappingcCr�r)r�rh)r"r#rgrrr
rhr�zXMLFilterBase.startElementcCrzr)r�rYr!rrr
rYr~zXMLFilterBase.endElementcC�|j�|||�dSr)r�rk)r"r#rjrgrrr
rk�zXMLFilterBase.startElementNScCr�r)r�rmrlrrr
rmr�zXMLFilterBase.endElementNScCrzr)r�rprorrr
rpr~zXMLFilterBase.characterscCrzr)r�rq)r"�charsrrr
rqr~z!XMLFilterBase.ignorableWhitespacecCr�r)r�rtrrrrr
rtr�z#XMLFilterBase.processingInstructioncCrzr)r��
skippedEntityr!rrr
r� r~zXMLFilterBase.skippedEntitycCr�r)�_dtd_handler�notationDecl)r"r#�publicId�systemIdrrr
r�%r�zXMLFilterBase.notationDeclcCs|j�||||�dSr)r��unparsedEntityDecl)r"r#r�r�Zndatarrr
r�(sz XMLFilterBase.unparsedEntityDeclcCs|j�||�Sr)Z_ent_handler�
resolveEntity)r"r�r�rrr
r�-r�zXMLFilterBase.resolveEntitycCs@|j�|�|j�|�|j�|�|j�|�|j�|�dSr)rwZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r"�sourcerrr
r�2s
zXMLFilterBase.parsecCrzr)rw�	setLocale)r"�localerrr
r�9r~zXMLFilterBase.setLocalecC�|j�|�Sr)rw�
getFeaturer!rrr
r�<r^zXMLFilterBase.getFeaturecCr�r)rw�
setFeature)r"r#�staterrr
r�?r�zXMLFilterBase.setFeaturecCr�r)rw�getPropertyr!rrr
r�Br^zXMLFilterBase.getPropertycCr�r)rw�setProperty)r"r#rrrr
r�Er�zXMLFilterBase.setPropertycCs|jSr�rwr[rrr
�	getParentJszXMLFilterBase.getParentcCs
||_dSrr�rxrrr
�	setParentMr'zXMLFilterBase.setParentr)r(r)r*rKr|rr�r�r\r]rcrerhrYrkrmrprqrtr�r�r�r�r�r�r�r�r�r�r�r�rrrr
ru�s<
ru�cCs"	t|tj�rt�|�}t|t�rt�|�}n/t|d�rF|}t��}t|�d�t�r0|�	|�n|�
|�t|d�rFt|jt�rF|�|j�|�
�dur�|��dur�|��}tj�tj�|��}tj�||�}tj�|�rx|�|�t|d�}n|�tj�||��tj�|���}|�
|�|S)N�readrr#�rb)r6�os�PathLike�fspathrnrZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamr#ZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�path�dirname�normpath�join�isfile�open�urllibr�ZurljoinZrequestZurlopen)r��base�fZsysidZbaseheadZ
sysidfilenamerrr
�prepare_input_sourceRs0





r�)r�)r�Zurllib.parser�Zurllib.requestr7r9r�rrrrrrrFrJrGrvrur�rrrr
�<module>s)so

?>