%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.8/xml/sax/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.8/xml/sax/__pycache__/saxutils.cpython-38.pyc

U

e5d�/�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	dd�Z
ifdd	�Zifd
d�Zifdd
�Z
dd�ZGdd�dej�ZGdd�de	j�Zddd�ZdS)znA library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
�N�)�handler)�	xmlreadercCs"|��D]\}}|�||�}q|S)z2Replace substrings of a string using a dictionary.)�items�replace)�s�d�key�value�r�(/usr/lib64/python3.8/xml/sax/saxutils.py�__dict_replacesr
cCs6|�dd�}|�dd�}|�dd�}|r2t||�}|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
��dataZentitiesrrr�escapes	
rcCs2|�dd�}|�dd�}|r&t||�}|�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.
    rrrrrrrrrrr�unescape"s

rcCsR|dddd��}t||�}d|krFd|kr<d|�dd�}qNd	|}nd|}|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')rrrrrr�	quoteattr0s

rcs��dkrddl}|jSt�tj�r&�St�tjtjf�r<�St�tj�rlG�fdd�d�}|�}dd�|_	nDt�
�}dd�|_�j|_z�j
|_
�j|_Wntk
r�YnXtj||ddd	d
�S)NrcseZdZ�jZ�fdd�ZdS)z _gettextwriter.<locals>._wrappercs
t�|�S�N)�getattr��self�name��outrr�__getattr__Zsz,_gettextwriter.<locals>._wrapper.__getattr__N)�__name__�
__module__�__qualname__�	__class__r&rr$rr�_wrapperXsr+cSsdSrrrrrr�<lambda>]�z _gettextwriter.<locals>.<lambda>cSsdS)NTrrrrr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%r/r3r+�bufferrr$r�_gettextwriterGs0
�rEc@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__rEr?�_write�flush�_flush�_ns_contexts�_current_context�_undeclared_ns_maps�	_encoding�_short_empty_elements�_pending_start_element)r"r%r/Zshort_empty_elementsrrrrJrs
zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r�:)rO)r"r#�prefixrrr�_qname~szXMLGenerator._qnamecCs|jr|�d�d|_dS)NrF�rSrK)r"�
endElementrrr�_finish_pending_start_element�s
z*XMLGenerator._finish_pending_start_elementcCs|�d|j�dS)Nz$<?xml version="1.0" encoding="%s"?>
)rKrQ�r"rrr�
startDocument�s�zXMLGenerator.startDocumentcCs|��dSr)rMrZrrr�endDocument�szXMLGenerator.endDocumentcCs0|j�|j���||j|<|j�||f�dSr)rN�appendrO�copyrP�r"rU�urirrr�startPrefixMapping�s
zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrO�r"rUrrr�endPrefixMapping�szXMLGenerator.endPrefixMappingcCsZ|��|�d|�|��D]\}}|�d|t|�f�q|jrLd|_n
|�d�dS)Nr� %s=%sTr)rYrKrrrRrS)r"r#�attrsr
rrr�startElement�szXMLGenerator.startElementcCs*|jr|�d�d|_n|�d|�dS�Nz/>Fz</%s>rWr!rrrrX�s
zXMLGenerator.endElementcCs�|��|�d|�|��|jD].\}}|rB|�d||f�q"|�d|�q"g|_|��D]$\}}|�d|�|�t|�f�q`|jr�d|_n
|�d�dS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#�qnamererUr`r
rrr�startElementNS�szXMLGenerator.startElementNScCs0|jr|�d�d|_n|�d|�|��dSrg)rSrKrV�r"r#rhrrr�endElementNS�s
zXMLGenerator.endElementNScCs4|r0|��t|t�s"t||j�}|�t|��dSr)rYr5�strrQrKr�r"Zcontentrrr�
characters�s

zXMLGenerator.characterscCs0|r,|��t|t�s"t||j�}|�|�dSr)rYr5rlrQrKrmrrr�ignorableWhitespace�s

z XMLGenerator.ignorableWhitespacecCs|��|�d||f�dS)Nz	<?%s %s?>)rYrK�r"�targetrrrr�processingInstruction�sz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrrrrrrFps


rFc@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�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.NcCstj�|�||_dSr)r�	XMLReaderrJ�_parent�r"�parentrrrrJ�szXMLFilterBase.__init__cCs|j�|�dSr)�_err_handler�error�r"Z	exceptionrrrry�szXMLFilterBase.errorcCs|j�|�dSr)rx�
fatalErrorrzrrrr{�szXMLFilterBase.fatalErrorcCs|j�|�dSr)rx�warningrzrrrr|�szXMLFilterBase.warningcCs|j�|�dSr)�
_cont_handler�setDocumentLocator)r"Zlocatorrrrr~�sz XMLFilterBase.setDocumentLocatorcCs|j��dSr)r}r[rZrrrr[�szXMLFilterBase.startDocumentcCs|j��dSr)r}r\rZrrrr\szXMLFilterBase.endDocumentcCs|j�||�dSr)r}rar_rrrrasz XMLFilterBase.startPrefixMappingcCs|j�|�dSr)r}rcrbrrrrcszXMLFilterBase.endPrefixMappingcCs|j�||�dSr)r}rf)r"r#rerrrrfszXMLFilterBase.startElementcCs|j�|�dSr)r}rXr!rrrrXszXMLFilterBase.endElementcCs|j�|||�dSr)r}ri)r"r#rhrerrrriszXMLFilterBase.startElementNScCs|j�||�dSr)r}rkrjrrrrkszXMLFilterBase.endElementNScCs|j�|�dSr)r}rnrmrrrrnszXMLFilterBase.characterscCs|j�|�dSr)r}ro)r"�charsrrrrosz!XMLFilterBase.ignorableWhitespacecCs|j�||�dSr)r}rrrprrrrrsz#XMLFilterBase.processingInstructioncCs|j�|�dSr)r}�
skippedEntityr!rrrr� szXMLFilterBase.skippedEntitycCs|j�|||�dSr)�_dtd_handler�notationDecl)r"r#�publicId�systemIdrrrr�%szXMLFilterBase.notationDeclcCs|j�||||�dSr)r��unparsedEntityDecl)r"r#r�r�Zndatarrrr�(sz XMLFilterBase.unparsedEntityDeclcCs|j�||�Sr)Z_ent_handler�
resolveEntity)r"r�r�rrrr�-szXMLFilterBase.resolveEntitycCs@|j�|�|j�|�|j�|�|j�|�|j�|�dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ
setDTDHandler�parse)r"�sourcerrrr�2s
zXMLFilterBase.parsecCs|j�|�dSr)ru�	setLocale)r"Zlocalerrrr�9szXMLFilterBase.setLocalecCs|j�|�Sr)ru�
getFeaturer!rrrr�<szXMLFilterBase.getFeaturecCs|j�||�dSr)ru�
setFeature)r"r#�staterrrr�?szXMLFilterBase.setFeaturecCs|j�|�Sr)ru�getPropertyr!rrrr�BszXMLFilterBase.getPropertycCs|j�||�dSr)ru�setProperty)r"r#r
rrrr�EszXMLFilterBase.setPropertycCs|jSr�rurZrrr�	getParentJszXMLFilterBase.getParentcCs
||_dSrr�rvrrr�	setParentMszXMLFilterBase.setParent)N) r'r(r)�__doc__rJryr{r|r~r[r\rarcrfrXrirkrnrorrr�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�s:
rs�cCs$t|tj�rt�|�}t|t�r,t�|�}n^t|d�r�|}t��}t|�d�t�r^|�	|�n
|�
|�t|d�r�t|jt�r�|�|j�|�
�dk�r |��dk�r |��}tj�tj�|��}tj�||�}tj�|�r�|�|�t|d�}n$|�tj�||��tj�|���}|�
|�|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)r5�os�PathLike�fspathrlrZInputSource�hasattrr�ZsetCharacterStreamZ
setByteStreamr#ZsetSystemIdZgetCharacterStreamZ
getByteStreamZgetSystemId�path�dirname�normpath�join�isfile�open�urllibr�ZurljoinZrequestZurlopen)r��base�fZsysidZbaseheadZ
sysidfilenamerrr�prepare_input_sourceRs.





r�)r�)r�r�Zurllib.parser�Zurllib.requestr6r8r�rrr
rrrrErIrFrtrsr�rrrr�<module>s)so

Zerion Mini Shell 1.0